Skip to content

Commit

Permalink
Merge pull request #234 from covalenthq/develop
Browse files Browse the repository at this point in the history
Bsp-agent-DTM-RC:v1.6.0
  • Loading branch information
noslav authored Mar 13, 2024
2 parents 6366dfc + ed03d32 commit f326b08
Show file tree
Hide file tree
Showing 14 changed files with 183 additions and 132 deletions.
26 changes: 25 additions & 1 deletion codec/block-ethereum.avsc
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,30 @@
"string"
],
"default":"null"
},
{
"name":"blobGasUsed",
"type":[
"null",
"int"
],
"default":"null"
},
{
"name":"excessBlobGas",
"type":[
"null",
"int"
],
"default":"null"
},
{
"name":"parentBeaconBlockRoot",
"type":[
"null",
"string"
],
"default":"null"
}
]
}
Expand Down Expand Up @@ -543,7 +567,7 @@
{
"name":"codecVersion",
"type":"double",
"default":0.35
"default":0.36
}
]
}
Binary file modified data/redis/dump.rdb
Binary file not shown.
2 changes: 1 addition & 1 deletion docker-compose-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ services:
sleep 1;
done;
echo proof-chain contracts deployed!;
./entry.sh;
./bsp-agent --redis-url=redis://username:@redis:6379/0?topic=replication-2#replicate --avro-codec-path=./codec/block-ethereum.avsc --binary-file-path=./bin/block-ethereum/ --block-divisor=3 --log-folder ./logs/ --metrics --metrics.port 6063 --metrics.addr 0.0.0.0 --proof-chain-address=0xEa2ff902dbeEECcc828757B881b343F9316752e5 --consumer-timeout=15 --ipfs-pinner-server="http://ipfs-pinner:3001/";
exit 0;"
environment:
- MB_PRIVATE_KEY=${PRIVATE_KEY}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ services:
sleep 1;
done;
echo proof-chain contracts deployed!;
./bsp-agent --redis-url=redis://username:@redis:6379/0?topic=replication#replicate --avro-codec-path=./codec/block-ethereum.avsc --binary-file-path=./bin/block-ethereum/ --block-divisor=3 --log-folder ./logs/ --metrics --metrics.port 6063 --metrics.addr 0.0.0.0 --proof-chain-address=0xEa2ff902dbeEECcc828757B881b343F9316752e5 --consumer-timeout=100000 --ipfs-pinner-server="http://ipfs-pinner:3001/";
./bsp-agent --redis-url=redis://username:@redis:6379/0?topic=replication-2#replicate --avro-codec-path=./codec/block-ethereum.avsc --binary-file-path=./bin/block-ethereum/ --block-divisor=3 --log-folder ./logs/ --metrics --metrics.port 6063 --metrics.addr 0.0.0.0 --proof-chain-address=0xEa2ff902dbeEECcc828757B881b343F9316752e5 --consumer-timeout=100000 --ipfs-pinner-server="http://ipfs-pinner:3001/";
exit 0;"
environment:
- MB_PRIVATE_KEY=${PRIVATE_KEY}
Expand Down
14 changes: 8 additions & 6 deletions entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ then
timeout 120s ./bsp-agent --redis-url=redis://username:@redis:6379/0?topic=replication-2#replicate \
--avro-codec-path=./codec/block-elrond.avsc \
--binary-file-path=./bin/block-elrond/ \
--proof-chain-address=0xea2ff902dbeeeccc828757b881b343f9316752e5\
--proof-chain-address=0xEa2ff902dbeEECcc828757B881b343F9316752e5\
--consumer-timeout=15 \
--websocket-urls="34.69.250.147:20000 34.69.250.147:20001 34.69.250.147:20002 34.69.250.147:20003"

else
./bsp-agent --redis-url=redis://username:@redis:6379/0?topic=replication#replicate \
--avro-codec-path=./codec/block-ethereum.avsc \
--binary-file-path=./bin/block-ethereum/ \
--block-divisor=3 \
--proof-chain-address=0xea2ff902dbeeeccc828757b881b343f9316752e5 \
./bsp-agent --redis-url=redis://username:@redis:6379/0?topic=replication-2#replicate \
--avro-codec-path=./codec/block-ethereum.avsc \
--binary-file-path=./bin/block-ethereum/ \
--block-divisor=3 \
--log-folder ./logs/ \
--proof-chain-address=0xEa2ff902dbeEECcc828757B881b343F9316752e5 \
--metrics --metrics.port 6063 --metrics.addr 0.0.0.0 \
--consumer-timeout=15 \
--ipfs-pinner-server="http://ipfs-pinner:3001/"
fi
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/djherbis/times v1.5.0 // indirect
github.com/fatih/color v1.15.0
github.com/fatih/color v1.16.0
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-stack/stack v1.8.1 // indirect
Expand All @@ -76,7 +76,7 @@ require (
github.com/influxdata/influxdb-client-go/v2 v2.13.0
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/miekg/dns v1.1.43 // indirect
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/ethereum/go-ethereum v1.11.5 h1:3M1uan+LAUvdn+7wCEFrcMM4LJTeuxDrPTg/f31a5QQ=
github.com/ethereum/go-ethereum v1.11.5/go.mod h1:it7x0DWnTDMfVFdXcU6Ti4KEFQynLHVRarcSlPr0HBo=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
Expand Down Expand Up @@ -383,8 +383,8 @@ github.com/mattn/go-ieproxy v0.0.1 h1:qiyop7gCflfhwCzGyeT0gro3sF9AIg9HU98JORTkqf
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104 h1:d8RFOZ2IiFtFWBcKEHAFYJcPTf0wY5q0exFNJZVWa1U=
Expand Down Expand Up @@ -766,6 +766,8 @@ golang.org/x/sys v0.0.0-20220405052023-b1e9470b6e64/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
Expand Down
2 changes: 2 additions & 0 deletions internal/node/eth_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ func (node *ethAgentNode) encodeProveAndUploadReplicaSegment(ctx context.Context
return pTxHash, nil
case strings.Contains(pTxHash, "already known"):
return pTxHash, nil
case strings.Contains(pTxHash, "max submissions limit exceeded"):
return pTxHash, nil
case pTxHash == "":
return "", fmt.Errorf("failed to prove & upload block-replica segment event: %v", currentSegment.SegmentName)
default:
Expand Down
7 changes: 7 additions & 0 deletions internal/proof/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ func executeWithRetry(ctx context.Context, interactor *ProofchainInteractor, pro
return
}

if strings.Contains(err.Error(), "Max submissions limit exceeded") {
log.Error("max submissions limit exceeded, skipping: ", err)
txHash <- "max submissions limit exceeded"

return
}

log.Error("error sending tx to deployed contract: ", err)
txHash <- ""

Expand Down
18 changes: 9 additions & 9 deletions internal/proof/proofchain.abi
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
{
"indexed": false,
"internalType": "uint256",
"name": "secondsPerBlock",
"name": "secondsPerBlockTargetChain",
"type": "uint256"
}
],
Expand Down Expand Up @@ -294,11 +294,11 @@
{
"indexed": true,
"internalType": "uint64",
"name": "secondsPerBlock",
"name": "secondsPerBlockCurrentChain",
"type": "uint64"
}
],
"name": "SecondsPerBlockChanged",
"name": "SecondsPerBlockCurrentChainChanged",
"type": "event"
},
{
Expand Down Expand Up @@ -594,7 +594,7 @@
},
{
"internalType": "uint256",
"name": "secondsPerBlock",
"name": "secondsPerBlockTargetChain",
"type": "uint256"
},
{
Expand Down Expand Up @@ -666,7 +666,7 @@
},
{
"internalType": "uint256",
"name": "secondsPerBlock",
"name": "secondsPerBlockCurrentChain",
"type": "uint256"
}
],
Expand Down Expand Up @@ -715,7 +715,7 @@
"inputs": [
{
"internalType": "address",
"name": "initialOwner",
"name": "initialGovernor",
"type": "address"
},
{
Expand Down Expand Up @@ -937,7 +937,7 @@
},
{
"internalType": "uint256",
"name": "secondsPerBlock",
"name": "secondsPerBlockTargetChain",
"type": "uint256"
}
],
Expand Down Expand Up @@ -1012,11 +1012,11 @@
"inputs": [
{
"internalType": "uint64",
"name": "secondsPerBlock",
"name": "secondsPerBlockCurrentChain",
"type": "uint64"
}
],
"name": "setSecondsPerBlock",
"name": "setSecondsPerBlockCurrentChain",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
Expand Down
179 changes: 89 additions & 90 deletions internal/proof/proofchain.go

Large diffs are not rendered by default.

37 changes: 20 additions & 17 deletions internal/types/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,26 @@ type BlockNonce [8]byte
type Bloom [BloomByteLength]byte

type Header struct {
ParentHash common.Hash `json:"parentHash"`
UncleHash common.Hash `json:"sha3Uncles"`
Coinbase common.Address `json:"miner"`
Root common.Hash `json:"stateRoot"`
TxHash common.Hash `json:"transactionsRoot"`
ReceiptHash common.Hash `json:"receiptsRoot"`
Bloom Bloom `json:"logsBloom"`
Difficulty *BigInt `json:"difficulty"`
Number *BigInt `json:"number"`
GasLimit uint64 `json:"gasLimit"`
GasUsed uint64 `json:"gasUsed"`
Time uint64 `json:"timestamp"`
Extra []byte `json:"extraData"`
MixDigest common.Hash `json:"mixHash"`
Nonce BlockNonce `json:"nonce"`
BaseFee *BigInt `json:"baseFeePerGas"`
WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"nil,optional"`
ParentHash common.Hash `json:"parentHash"`
UncleHash common.Hash `json:"sha3Uncles"`
Coinbase common.Address `json:"miner"`
Root common.Hash `json:"stateRoot"`
TxHash common.Hash `json:"transactionsRoot"`
ReceiptHash common.Hash `json:"receiptsRoot"`
Bloom Bloom `json:"logsBloom"`
Difficulty *BigInt `json:"difficulty"`
Number *BigInt `json:"number"`
GasLimit uint64 `json:"gasLimit"`
GasUsed uint64 `json:"gasUsed"`
Time uint64 `json:"timestamp"`
Extra []byte `json:"extraData"`
MixDigest common.Hash `json:"mixHash"`
Nonce BlockNonce `json:"nonce"`
BaseFee *BigInt `json:"baseFeePerGas"`
WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"nil,optional"`
BlobGasUsed *uint64 `json:"blobGasUsed" rlp:"optional"`
ExcessBlobGas *uint64 `json:"excessBlobGas" rlp:"optional"`
ParentBeaconRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"`
}

type Transaction struct {
Expand Down
4 changes: 3 additions & 1 deletion internal/utils/lenspath.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ var fromLens = composeLenspath(transactionsLens, []string{"from"})

var headerLens = composeLenspath(dataLens, []string{"Header"})
var withdrawalsRootLens = composeLenspath(headerLens, []string{"withdrawalsRoot"})

var blobGasUsedLens = composeLenspath(headerLens, []string{"blobGasUsed"})
var excessBlobGasLens = composeLenspath(headerLens, []string{"excessBlobGas"})
var parentBeaconRootLens = composeLenspath(headerLens, []string{"parentBeaconBlockRoot"})
var withdrawalsLens = composeLenspath(dataLens, []string{"Withdrawals"})
var uncleLens = composeLenspath(dataLens, []string{"Uncles"})

Expand Down
10 changes: 10 additions & 0 deletions internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ func UnwrapAvroUnion(data map[string]interface{}) map[string]interface{} {
unwrapType(data, withdrawalsLens, "array")
unwrapType(data, uncleLens, "array")

// blobs
unwrapType(data, blobGasUsedLens, "int")
unwrapType(data, excessBlobGasLens, "int")
unwrapType(data, parentBeaconRootLens, "string")

return data
}

Expand All @@ -259,6 +264,11 @@ func MapToAvroUnion(data map[string]interface{}) map[string]interface{} {
wrapType(data, withdrawalsLens, "array")
wrapType(data, uncleLens, "array")

// blobs
wrapType(data, blobGasUsedLens, "int")
wrapType(data, excessBlobGasLens, "int")
wrapType(data, parentBeaconRootLens, "string")

return data
}

Expand Down

0 comments on commit f326b08

Please sign in to comment.