Skip to content

Commit 01225bf

Browse files
committed
fix: chain meta voting
1 parent c29ac9f commit 01225bf

File tree

5 files changed

+9
-18
lines changed

5 files changed

+9
-18
lines changed

universalClient/chains/evm/chain_meta_oracle.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,14 @@ func (g *ChainMetaOracle) fetchAndVoteChainMeta(ctx context.Context) {
9797
continue
9898
}
9999

100-
// Vote on chain meta (gas price + block height + observation timestamp)
100+
// Vote on chain meta (gas price + block height)
101101
priceUint64 := gasPrice.Uint64()
102-
observedAt := uint64(time.Now().Unix())
103-
voteTxHash, err := g.pushSigner.VoteChainMeta(ctx, g.chainID, priceUint64, blockNumber, observedAt)
102+
voteTxHash, err := g.pushSigner.VoteChainMeta(ctx, g.chainID, priceUint64, blockNumber)
104103
if err != nil {
105104
g.logger.Error().
106105
Err(err).
107106
Uint64("price", priceUint64).
108107
Uint64("block", blockNumber).
109-
Uint64("observed_at", observedAt).
110108
Msg("failed to vote on chain meta")
111109
continue
112110
}
@@ -115,7 +113,6 @@ func (g *ChainMetaOracle) fetchAndVoteChainMeta(ctx context.Context) {
115113
Str("vote_tx_hash", voteTxHash).
116114
Uint64("price", priceUint64).
117115
Uint64("block", blockNumber).
118-
Uint64("observed_at", observedAt).
119116
Msg("successfully voted on chain meta")
120117
}
121118
}

universalClient/chains/svm/chain_meta_oracle.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,14 @@ func (g *ChainMetaOracle) fetchAndVoteChainMeta(ctx context.Context) {
9797
continue
9898
}
9999

100-
// Vote on chain meta (gas price + slot height + observation timestamp)
100+
// Vote on chain meta (gas price + slot height)
101101
priceUint64 := gasPrice.Uint64()
102-
observedAt := uint64(time.Now().Unix())
103-
voteTxHash, err := g.pushSigner.VoteChainMeta(ctx, g.chainID, priceUint64, slotNumber, observedAt)
102+
voteTxHash, err := g.pushSigner.VoteChainMeta(ctx, g.chainID, priceUint64, slotNumber)
104103
if err != nil {
105104
g.logger.Error().
106105
Err(err).
107106
Uint64("price", priceUint64).
108107
Uint64("slot", slotNumber).
109-
Uint64("observed_at", observedAt).
110108
Msg("failed to vote on chain meta")
111109
continue
112110
}
@@ -115,7 +113,6 @@ func (g *ChainMetaOracle) fetchAndVoteChainMeta(ctx context.Context) {
115113
Str("vote_tx_hash", voteTxHash).
116114
Uint64("price", priceUint64).
117115
Uint64("slot", slotNumber).
118-
Uint64("observed_at", observedAt).
119116
Msg("successfully voted on chain meta")
120117
}
121118
}

universalClient/pushsigner/pushsigner.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ func (s *Signer) VoteInbound(ctx context.Context, inbound *uexecutortypes.Inboun
104104
return voteInbound(ctx, s, s.log, s.granter, inbound)
105105
}
106106

107-
// VoteChainMeta votes on chain metadata (gas price, block height, observation timestamp).
108-
func (s *Signer) VoteChainMeta(ctx context.Context, chainID string, price uint64, chainHeight uint64, observedAt uint64) (string, error) {
109-
return voteChainMeta(ctx, s, s.log, s.granter, chainID, price, chainHeight, observedAt)
107+
// VoteChainMeta votes on chain metadata (gas price, block height).
108+
func (s *Signer) VoteChainMeta(ctx context.Context, chainID string, price uint64, chainHeight uint64) (string, error) {
109+
return voteChainMeta(ctx, s, s.log, s.granter, chainID, price, chainHeight)
110110
}
111111

112112
// VoteOutbound votes on an outbound transaction observation.

universalClient/pushsigner/vote.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func voteInbound(
8686
return vote(ctx, signer, log, msg, memo)
8787
}
8888

89-
// voteChainMeta votes on chain metadata (gas price, block height, observation timestamp)
89+
// voteChainMeta votes on chain metadata (gas price, block height)
9090
func voteChainMeta(
9191
ctx context.Context,
9292
signer *Signer,
@@ -95,14 +95,12 @@ func voteChainMeta(
9595
chainID string,
9696
price uint64,
9797
chainHeight uint64,
98-
observedAt uint64,
9998
) (string, error) {
10099
msg := &uexecutortypes.MsgVoteChainMeta{
101100
Signer: granter,
102101
ObservedChainId: chainID,
103102
Price: price,
104103
ChainHeight: chainHeight,
105-
ObservedAt: observedAt,
106104
}
107105
memo := fmt.Sprintf("Vote chain meta: %s @ price=%d height=%d", chainID, price, chainHeight)
108106
return vote(ctx, signer, log, msg, memo)

x/uexecutor/types/msg_vote_chain_meta.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ var (
1414
func NewMsgVoteChainMeta(
1515
sender sdk.Address,
1616
observedChainId string,
17-
price, chainHeight, observedAt uint64,
17+
price, chainHeight uint64,
1818
) *MsgVoteChainMeta {
1919
return &MsgVoteChainMeta{
2020
Signer: sender.String(),
2121
ObservedChainId: observedChainId,
2222
Price: price,
2323
ChainHeight: chainHeight,
24-
ObservedAt: observedAt,
2524
}
2625
}
2726

0 commit comments

Comments
 (0)