Skip to content

Commit

Permalink
Node: Update Celo watcher (#4210)
Browse files Browse the repository at this point in the history
* Node: Update Celo watcher

* Code review rework
  • Loading branch information
bruce-riley authored Jan 7, 2025
1 parent db1ee86 commit 56cf37a
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 2,241 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ jobs:
go-version: "1.23.3"
# The go-ethereum and celo-blockchain packages both implement secp256k1 using the exact same header, but that causes duplicate symbols.
- name: Run golang tests
run: cd node && go test -v -timeout 5m -race -ldflags '-extldflags "-Wl,--allow-multiple-definition" ' ./...
run: cd node && go test -v -timeout 5m -race ./...

# Run Rust lints and tests
rust-lint-and-tests:
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ node: $(BIN)/guardiand
.PHONY: $(BIN)/guardiand
$(BIN)/guardiand: CGO_ENABLED=1
$(BIN)/guardiand: dirs generate
@# The go-ethereum and celo-blockchain packages both implement secp256k1 using the exact same header, but that causes duplicate symbols.
cd node && go build -ldflags "-X github.com/certusone/wormhole/node/pkg/version.version=${VERSION} -extldflags -Wl,--allow-multiple-definition" \
cd node && go build -ldflags "-X github.com/certusone/wormhole/node/pkg/version.version=${VERSION}" \
-mod=readonly -o ../$(BIN)/guardiand \
github.com/certusone/wormhole/node
2 changes: 1 addition & 1 deletion node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ARG GO_BUILD_ARGS=-race
RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go \
export CGO_ENABLED=1 && \
cd node && \
go build ${GO_BUILD_ARGS} -gcflags="all=-N -l" --ldflags '-extldflags "-Wl,--allow-multiple-definition" -X "github.com/certusone/wormhole/node/cmd/guardiand.Build=dev"' -mod=readonly -o /guardiand github.com/certusone/wormhole/node && \
go build ${GO_BUILD_ARGS} -gcflags="all=-N -l" --ldflags '-X "github.com/certusone/wormhole/node/cmd/guardiand.Build=dev"' -mod=readonly -o /guardiand github.com/certusone/wormhole/node && \
go get github.com/CosmWasm/[email protected] && \
cp /go/pkg/mod/github.com/!cosm!wasm/[email protected]/internal/api/libwasmvm.*.so /usr/lib/

Expand Down
14 changes: 2 additions & 12 deletions node/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
.PHONY test
.PHONY: test
test:
# Use this command on amd64 systems
go test -v -ldflags '-extldflags "-Wl,--allow-multiple-definition" ' ./...

.PHONY test-arm64
test-arm64:
# Use this command on arm64, otherwise you will encounter linker errors.
# It's not perfect: it will fail due to 'undefined symbols' errors
# for packges using cgo. Still, it will get you farther than running
# the default command.
# To test a single package, use these -ldflags with e.g. ./pkg/governor
go test -ldflags '-extldflags "-Wl,-ld_classic " ' ./...
go test -v ./...
15 changes: 4 additions & 11 deletions node/hack/parse_eth_tx/parse_eth_tx.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// To compile:
// go build --ldflags '-extldflags "-Wl,--allow-multiple-definition"' -o parse_eth_tx
// go build -o parse_eth_tx
// Usage:
// ./parse_eth_tx -chainID=14 -ethRPC=wss://alfajores-forno.celo-testnet.org/ws -contractAddr=0x88505117CA88e7dd2eC6EA1E13f0948db2D50D56 -tx=0x20a1e7e491dd82b6b33db0820e88a96b58bac28d65770ea73af80e457745aab1

Expand Down Expand Up @@ -39,16 +39,9 @@ func main() {

var ethIntf connectors.Connector
var err error
if chainID == vaa.ChainIDCelo {
ethIntf, err = connectors.NewCeloConnector(ctx, "", *flagEthRPC, contractAddr, zap.L())
if err != nil {
log.Fatalf("dialing eth client failed: %v", err)
}
} else {
ethIntf, err = connectors.NewEthereumBaseConnector(ctx, "", *flagEthRPC, contractAddr, zap.L())
if err != nil {
log.Fatalf("dialing eth client failed: %v", err)
}
ethIntf, err = connectors.NewEthereumBaseConnector(ctx, "", *flagEthRPC, contractAddr, zap.L())
if err != nil {
log.Fatalf("dialing eth client failed: %v", err)
}

transactionHash := ethCommon.HexToHash(*flagTx)
Expand Down
2 changes: 1 addition & 1 deletion node/hack/query/ccqlistener/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ARG GO_BUILD_ARGS=-race
RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go \
export CGO_ENABLED=1 && \
cd node/hack/query/ccqlistener && \
go build ${GO_BUILD_ARGS} -gcflags="all=-N -l" --ldflags '-extldflags "-Wl,--allow-multiple-definition" -X "github.com/certusone/wormhole/node/cmd/guardiand.Build=dev"' -mod=readonly -o /ccqlistener ccqlistener.go && \
go build ${GO_BUILD_ARGS} -gcflags="all=-N -l" --ldflags '-X "github.com/certusone/wormhole/node/cmd/guardiand.Build=dev"' -mod=readonly -o /ccqlistener ccqlistener.go && \
go get github.com/CosmWasm/[email protected] && \
cp /go/pkg/mod/github.com/!cosm!wasm/[email protected]/internal/api/libwasmvm.x86_64.so /usr/lib/

Expand Down
2 changes: 1 addition & 1 deletion node/pkg/node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ func BenchmarkCrypto(b *testing.B) {

// How to run:
//
// go test -v -ldflags '-extldflags "-Wl,--allow-multiple-definition" ' -bench ^BenchmarkConsensus -benchtime=1x -count 1 -run ^$ > bench.log; tail bench.log
// go test -v -bench ^BenchmarkConsensus -benchtime=1x -count 1 -run ^$ > bench.log; tail bench.log
func BenchmarkConsensus(b *testing.B) {
require.Equal(b, b.N, 1)
//CONSOLE_LOG_LEVEL = zap.DebugLevel
Expand Down
4 changes: 1 addition & 3 deletions node/pkg/watchers/evm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ func (wc *WatcherConfig) Create(
setWriteC = setC
}

var devMode bool = (env == common.UnsafeDevNet)

watcher := NewEthWatcher(wc.Rpc, eth_common.HexToAddress(wc.Contract), string(wc.NetworkID), wc.ChainID, msgC, setWriteC, obsvReqC, queryReqC, queryResponseC, devMode, wc.CcqBackfillCache)
watcher := NewEthWatcher(wc.Rpc, eth_common.HexToAddress(wc.Contract), string(wc.NetworkID), wc.ChainID, msgC, setWriteC, obsvReqC, queryReqC, queryResponseC, env, wc.CcqBackfillCache)
watcher.SetL1Finalizer(wc.l1Finalizer)
return watcher, watcher.Run, nil
}
291 changes: 0 additions & 291 deletions node/pkg/watchers/evm/connectors/celo.go

This file was deleted.

Loading

0 comments on commit 56cf37a

Please sign in to comment.