Skip to content

Commit cbe9e69

Browse files
authored
Geth-specific Blockscout version + internal txs + verifier (#2145)
* add sc verifier service, specify chain ID * check that internal txs are working * changeset
1 parent 0dc0ebb commit cbe9e69

File tree

5 files changed

+30
-17
lines changed

5 files changed

+30
-17
lines changed

framework/.changeset/v0.10.27.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Blockscout Geth variant + internal transactions + verifier

framework/cmd/main.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ func main() {
147147
Aliases: []string{"u"},
148148
Description: "Spins up Blockscout stack",
149149
Action: func(c *cli.Context) error {
150-
return framework.BlockScoutUp(c.String("rpc"))
150+
return framework.BlockScoutUp(
151+
c.String("rpc"),
152+
c.String("chain-id"),
153+
)
151154
},
152155
},
153156
{
@@ -169,7 +172,10 @@ func main() {
169172
if err := framework.BlockScoutDown(rpc); err != nil {
170173
return err
171174
}
172-
return framework.BlockScoutUp(rpc)
175+
return framework.BlockScoutUp(
176+
c.String("rpc"),
177+
c.String("chain-id"),
178+
)
173179
},
174180
},
175181
},

framework/observability.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,13 @@ func extractAllFiles(embeddedDir string) error {
7878
return err
7979
}
8080

81-
func BlockScoutUp(url string) error {
81+
func BlockScoutUp(url, chainID string) error {
8282
L.Info().Msg("Creating local Blockscout stack")
8383
if err := extractAllFiles("observability"); err != nil {
8484
return err
8585
}
8686
os.Setenv("BLOCKSCOUT_RPC_URL", url)
87+
os.Setenv("BLOCKSCOUT_CHAID_ID", chainID)
8788
// old migrations for v15 is still applied somehow, cleaning up DB helps
8889
if err := RunCommand("bash", "-c", fmt.Sprintf(`
8990
cd %s && \
@@ -117,14 +118,7 @@ func BlockScoutDown(url string) error {
117118
if err != nil {
118119
return err
119120
}
120-
return RunCommand("bash", "-c", fmt.Sprintf(`
121-
cd %s && \
122-
rm -rf blockscout-db-data && \
123-
rm -rf logs && \
124-
rm -rf redis-data && \
125-
rm -rf stats-db-data && \
126-
rm -rf dets
127-
`, filepath.Join("blockscout", "services")))
121+
return RunCommand("bash", "-c", "rm -rf blockscout/")
128122
}
129123

130124
func ObservabilityUp() error {
@@ -186,5 +180,5 @@ func ObservabilityDown() error {
186180
if err != nil {
187181
return err
188182
}
189-
return nil
183+
return RunCommand("bash", "-c", "rm -rf compose/")
190184
}

framework/observability/blockscout/docker-compose.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ services:
1717
file: ./services/db.yml
1818
service: db
1919

20+
sc-verifier:
21+
extends:
22+
file: ./services/smart-contract-verifier.yml
23+
service: smart-contract-verifier
24+
ports:
25+
- 8082:8050
26+
2027
backend:
2128
depends_on:
2229
- db
@@ -32,10 +39,14 @@ services:
3239
links:
3340
- db:database
3441
environment:
35-
ETHEREUM_JSONRPC_HTTP_URL: http://host.docker.internal:8545/
36-
ETHEREUM_JSONRPC_TRACE_URL: http://host.docker.internal:8545/
37-
ETHEREUM_JSONRPC_WS_URL: ws://host.docker.internal:8545/
38-
CHAIN_ID: '1337'
42+
# 'anvil' do not support internal transactions
43+
ETHEREUM_JSONRPC_VARIANT: 'geth'
44+
ETHEREUM_JSONRPC_HTTP_URL: ${BLOCKSCOUT_RPC_URL}
45+
ETHEREUM_JSONRPC_TRACE_URL: ${BLOCKSCOUT_RPC_URL}
46+
CHAIN_ID: ${BLOCKSCOUT_CHAIN_ID:-1337}
47+
MICROSERVICE_SC_VERIFIER_ENABLED: true
48+
MICROSERVICE_SC_VERIFIER_URL: http://smart-contract-verifier:8050/
49+
MICROSERVICE_SC_VERIFIER_TYPE: sc_verifier
3950

4051
nft_media_handler:
4152
depends_on:
@@ -103,3 +114,4 @@ services:
103114
extends:
104115
file: ./services/nginx.yml
105116
service: proxy
117+

framework/observability/blockscout/services/backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.9'
22

33
services:
44
backend:
5-
image: ghcr.io/blockscout/${DOCKER_REPO:-blockscout}:${DOCKER_TAG:-latest}
5+
image: ghcr.io/blockscout/${DOCKER_REPO:-blockscout}:${DOCKER_TAG:-9.0.2.commit.2ab549a6}
66
pull_policy: always
77
restart: always
88
stop_grace_period: 5m

0 commit comments

Comments
 (0)