Skip to content

Commit a7bf5d6

Browse files
Binaries now fetch during Dockerfile build instead of startup script, and land in usr bin instead of repo directory
1 parent e08ceca commit a7bf5d6

File tree

5 files changed

+42
-43
lines changed

5 files changed

+42
-43
lines changed

.devcontainer/smart-contracts/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ RUN apt-get update && \
3636
apt-get clean && \
3737
rm -rf /var/lib/apt/lists/*
3838

39+
# Fetch `substrate-node` and `eth-rpc` binaries TODO! grab from latest stable release (need to wait on this until next release actually runs)
40+
RUN wget -q -O /usr/local/bin/substrate-node \
41+
http://releases.parity.io/substrate-node/polkadot-stable2555-rc5/x86_64-unknown-linux-gnu/substrate-node && \
42+
wget -q -O /usr/local/bin/eth-rpc \
43+
http://releases.parity.io/eth-rpc/polkadot-stable2555-rc5/x86_64-unknown-linux-gnu/eth-rpc && \
44+
chmod +x /usr/local/bin/substrate-node /usr/local/bin/eth-rpc
45+
3946
USER vscode
4047
ARG USER_HOME=/home/vscode
4148
WORKDIR $USER_HOME
4249

43-
4450
# Install Foundry and Polkadot tools
4551
RUN curl -L https://raw.githubusercontent.com/paritytech/foundry-polkadot/refs/heads/master/foundryup/install | bash && \
4652
$USER_HOME/.foundry/bin/foundryup-polkadot

.devcontainer/smart-contracts/init-hardhat/hardhat.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ const config: HardhatUserConfig = {
1919
hardhat: {
2020
polkavm: true,
2121
nodeConfig: {
22-
nodeBinaryPath: "binaries/substrate-node",
22+
nodeBinaryPath: "substrate-node",
2323
rpcPort: 8000,
2424
dev: true,
2525
},
2626
adapterConfig: {
27-
adapterBinaryPath: "binaries/eth-rpc",
27+
adapterBinaryPath: "eth-rpc",
2828
dev: true,
2929
},
3030
},

.devcontainer/smart-contracts/init-hardhat/package-lock.json

Lines changed: 33 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.devcontainer/smart-contracts/scripts/devtool-scripts/init-hardhat.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
if ! compgen -G "$PROJECT_DIR/hardhat.config.*" > /dev/null; then
33
echo -e "${YELLOW}📦 Initializing new Polkadot Hardhat project...${STYLE_END}"
44
echo -e "${GREEN}✓ Copying project template files...${STYLE_END}"
5-
6-
# Copy all template files
75

86
# Fetch template project
97
REPO="https://github.com/paritytech/DevEx-DevRel.git"

.devcontainer/smart-contracts/scripts/devtool-scripts/setup-devcontainer.sh

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -63,43 +63,8 @@ if [ "$EMULATION_MODE" = "true" ]; then
6363
echo -e "${YELLOW}⚠️ Performance Warning: Running x86_64 binaries under emulation may be slower${STYLE_END}"
6464
echo -e "${YELLOW} Consider using native ARM64 binaries for better performance${STYLE_END}"
6565
fi
66-
6766
echo ""
6867

69-
# Download Linux AMD64 binaries
70-
echo -e "${BLUE}🔧 Setting up binaries...${STYLE_END}"
71-
72-
# Create binaries directory if it doesn't exist
73-
mkdir -p $PROJECT_DIR/binaries
74-
75-
# Download binaries for Linux AMD64
76-
cd $PROJECT_DIR/binaries
77-
78-
echo -e "${GREEN}Downloading Linux AMD64 binaries...${STYLE_END}"
79-
wget -q -O substrate-node "http://releases.parity.io/substrate-node/polkadot-stable2555-rc5/x86_64-unknown-linux-gnu/substrate-node" || {
80-
echo -e "${YELLOW}Failed to download substrate-node, using dummy binary${STYLE_END}"
81-
echo "#!/bin/bash" > substrate-node
82-
echo "echo 'substrate-node dummy binary - download failed'" >> substrate-node
83-
}
84-
85-
wget -q -O eth-rpc "http://releases.parity.io/eth-rpc/polkadot-stable2555-rc5/x86_64-unknown-linux-gnu/eth-rpc" || {
86-
echo -e "${YELLOW}Failed to download eth-rpc, using dummy binary${STYLE_END}"
87-
echo "#!/bin/bash" > eth-rpc
88-
echo "echo 'eth-rpc dummy binary - download failed'" >> eth-rpc
89-
}
90-
91-
# Check binary architecture if file command is available
92-
if command -v file >/dev/null 2>&1; then
93-
echo -e "${BLUE}ℹ️ Downloaded binary information:${STYLE_END}"
94-
file substrate-node 2>/dev/null | grep -q "ELF" && file substrate-node || echo " substrate-node: not a valid binary"
95-
file eth-rpc 2>/dev/null | grep -q "ELF" && file eth-rpc || echo " eth-rpc: not a valid binary"
96-
fi
97-
98-
# Make binaries executable
99-
chmod +x substrate-node eth-rpc
100-
101-
echo -e "${GREEN}✓ Binaries setup complete${STYLE_END}"
102-
10368
# Additional debugging for emulation mode
10469
if [ "$EMULATION_MODE" = "true" ]; then
10570
echo -e "${YELLOW}⚠️ Note: x86_64 binaries will be executed under emulation${STYLE_END}"

0 commit comments

Comments
 (0)