Skip to content

Commit

Permalink
Fix default gas limit on execution config
Browse files Browse the repository at this point in the history
  • Loading branch information
aivarasko committed Oct 30, 2024
1 parent 6b370f5 commit 5d7ca19
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
6 changes: 5 additions & 1 deletion services/blockrelay/v2/executionconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ func (e *ExecutionConfig) setInitialRelayOptions(_ context.Context,
} else {
configRelay.MinValue = *e.MinValue
}
setRelayConfig(configRelay, baseRelayConfig, config.FeeRecipient, fallbackGasLimit)
if e.GasLimit == nil {
setRelayConfig(configRelay, baseRelayConfig, config.FeeRecipient, fallbackGasLimit)
} else {
setRelayConfig(configRelay, baseRelayConfig, config.FeeRecipient, *e.GasLimit)
}
config.Relays = append(config.Relays, configRelay)
}
}
Expand Down
56 changes: 56 additions & 0 deletions services/blockrelay/v2/executionconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,62 @@ func TestConfig(t *testing.T) {
},
},
},
{
name: "ExecutionConfigDefaultGasLimit",
executionConfig: &v2.ExecutionConfig{
GasLimit: &gasLimit4,
Proposers: []*v2.ProposerConfig{},
FeeRecipient: &feeRecipient3,
Relays: map[string]*v2.BaseRelayConfig{
"https://relay1.com/": {},
},
},
account: account1,
pubkey: pubkey1,
fallbackFeeRecipient: feeRecipient1,
fallbackGasLimit: gasLimit1,
expected: &beaconblockproposer.ProposerConfig{
FeeRecipient: feeRecipient3,
Relays: []*beaconblockproposer.RelayConfig{
{
Address: "https://relay1.com/",
FeeRecipient: feeRecipient3,
GasLimit: gasLimit4,
Grace: grace0,
MinValue: minValue0,
},
},
},
},
{
name: "ExecutionConfigDefaultAndRelayGasLimit",
executionConfig: &v2.ExecutionConfig{
GasLimit: &gasLimit4,
Proposers: []*v2.ProposerConfig{},
FeeRecipient: &feeRecipient3,
Relays: map[string]*v2.BaseRelayConfig{
"https://relay1.com/": {
GasLimit: &gasLimit3,
},
},
},
account: account1,
pubkey: pubkey1,
fallbackFeeRecipient: feeRecipient1,
fallbackGasLimit: gasLimit1,
expected: &beaconblockproposer.ProposerConfig{
FeeRecipient: feeRecipient3,
Relays: []*beaconblockproposer.RelayConfig{
{
Address: "https://relay1.com/",
FeeRecipient: feeRecipient3,
GasLimit: gasLimit3,
Grace: grace0,
MinValue: minValue0,
},
},
},
},
{
name: "InvalidProposerConfig",
executionConfig: &v2.ExecutionConfig{
Expand Down

0 comments on commit 5d7ca19

Please sign in to comment.