Skip to content

Commit 81b31df

Browse files
Remove secondary validator override (#1313)
1 parent b5c6acf commit 81b31df

File tree

2 files changed

+9
-31
lines changed

2 files changed

+9
-31
lines changed

plugin/evm/vm.go

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ func (vm *VM) CreateHandlers(context.Context) (map[string]http.Handler, error) {
10771077
warpSDKClient := vm.Network.NewClient(p2p.SignatureRequestHandlerID)
10781078
signatureAggregator := acp118.NewSignatureAggregator(vm.ctx.Log, warpSDKClient)
10791079

1080-
if err := handler.RegisterName("warp", warp.NewAPI(vm.ctx, vm.warpBackend, signatureAggregator, vm.requirePrimaryNetworkSigners)); err != nil {
1080+
if err := handler.RegisterName("warp", warp.NewAPI(vm.ctx, vm.warpBackend, signatureAggregator)); err != nil {
10811081
return nil, err
10821082
}
10831083
enabledAPIs = append(enabledAPIs, "warp")
@@ -1111,24 +1111,6 @@ func (vm *VM) rules(number *big.Int, time uint64) extras.Rules {
11111111
return *params.GetRulesExtra(ethrules)
11121112
}
11131113

1114-
// currentRules returns the chain rules for the current block.
1115-
func (vm *VM) currentRules() extras.Rules {
1116-
header := vm.eth.APIBackend.CurrentHeader()
1117-
return vm.rules(header.Number, header.Time)
1118-
}
1119-
1120-
// requirePrimaryNetworkSigners returns true if warp messages from the primary
1121-
// network must be signed by the primary network validators.
1122-
// This is necessary when the subnet is not validating the primary network.
1123-
func (vm *VM) requirePrimaryNetworkSigners() bool {
1124-
switch c := vm.currentRules().Precompiles[warpcontract.ContractAddress].(type) {
1125-
case *warpcontract.Config:
1126-
return c.RequirePrimaryNetworkSigners
1127-
default: // includes nil due to non-presence
1128-
return false
1129-
}
1130-
}
1131-
11321114
func (vm *VM) startContinuousProfiler() {
11331115
// If the profiler directory is empty, return immediately
11341116
// without creating or starting a continuous profiler.

warp/service.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,22 @@ import (
1717
"github.com/ava-labs/libevm/log"
1818

1919
warpprecompile "github.com/ava-labs/coreth/precompile/contracts/warp"
20-
warpValidators "github.com/ava-labs/coreth/warp/validators"
2120
)
2221

2322
var errNoValidators = errors.New("cannot aggregate signatures from subnet with no validators")
2423

2524
// API introduces snowman specific functionality to the evm
2625
type API struct {
27-
chainContext *snow.Context
28-
backend Backend
29-
signatureAggregator *acp118.SignatureAggregator
30-
requirePrimaryNetworkSigners func() bool
26+
chainContext *snow.Context
27+
backend Backend
28+
signatureAggregator *acp118.SignatureAggregator
3129
}
3230

33-
func NewAPI(chainCtx *snow.Context, backend Backend, signatureAggregator *acp118.SignatureAggregator, requirePrimaryNetworkSigners func() bool) *API {
31+
func NewAPI(chainCtx *snow.Context, backend Backend, signatureAggregator *acp118.SignatureAggregator) *API {
3432
return &API{
35-
backend: backend,
36-
chainContext: chainCtx,
37-
signatureAggregator: signatureAggregator,
38-
requirePrimaryNetworkSigners: requirePrimaryNetworkSigners,
33+
backend: backend,
34+
chainContext: chainCtx,
35+
signatureAggregator: signatureAggregator,
3936
}
4037
}
4138

@@ -108,8 +105,7 @@ func (a *API) aggregateSignatures(ctx context.Context, unsignedMessage *warp.Uns
108105
return nil, err
109106
}
110107

111-
state := warpValidators.NewState(validatorState, a.chainContext.SubnetID, a.chainContext.ChainID, a.requirePrimaryNetworkSigners())
112-
validatorSet, err := warp.GetCanonicalValidatorSetFromSubnetID(ctx, state, pChainHeight, subnetID)
108+
validatorSet, err := warp.GetCanonicalValidatorSetFromSubnetID(ctx, validatorState, pChainHeight, subnetID)
113109
if err != nil {
114110
return nil, fmt.Errorf("failed to get validator set: %w", err)
115111
}

0 commit comments

Comments
 (0)