fix message attestation for Solana
Change-Id: Iaf79984980affe64f268c2eed9f61d5058cea0dd
This commit is contained in:
parent
b61c08208f
commit
b85cbacd3b
|
@ -22,14 +22,14 @@ var (
|
||||||
Name: "wormhole_lockups_observed_total",
|
Name: "wormhole_lockups_observed_total",
|
||||||
Help: "Total number of lockups received on-chain",
|
Help: "Total number of lockups received on-chain",
|
||||||
},
|
},
|
||||||
[]string{"source_chain", "target_chain"})
|
[]string{"emitter_chain"})
|
||||||
|
|
||||||
lockupsSignedTotal = prometheus.NewCounterVec(
|
lockupsSignedTotal = prometheus.NewCounterVec(
|
||||||
prometheus.CounterOpts{
|
prometheus.CounterOpts{
|
||||||
Name: "wormhole_lockups_signed_total",
|
Name: "wormhole_lockups_signed_total",
|
||||||
Help: "Total number of lockups that were successfully signed",
|
Help: "Total number of lockups that were successfully signed",
|
||||||
},
|
},
|
||||||
[]string{"source_chain", "target_chain"})
|
[]string{"emitter_chain"})
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -64,6 +64,7 @@ func (p *Processor) handleLockup(ctx context.Context, k *common.MessagePublicati
|
||||||
EmitterChain: k.EmitterChain,
|
EmitterChain: k.EmitterChain,
|
||||||
EmitterAddress: k.EmitterAddress,
|
EmitterAddress: k.EmitterAddress,
|
||||||
Payload: k.Payload,
|
Payload: k.Payload,
|
||||||
|
Sequence: k.Sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate digest of the unsigned VAA.
|
// Generate digest of the unsigned VAA.
|
||||||
|
|
|
@ -208,6 +208,10 @@ func (p *Processor) handleObservation(ctx context.Context, m *gossipv1.SignedObs
|
||||||
GuardianSetIndex: v.GuardianSetIndex,
|
GuardianSetIndex: v.GuardianSetIndex,
|
||||||
Signatures: sigs,
|
Signatures: sigs,
|
||||||
Timestamp: v.Timestamp,
|
Timestamp: v.Timestamp,
|
||||||
|
Nonce: v.Nonce,
|
||||||
|
Sequence: v.Sequence,
|
||||||
|
EmitterChain: v.EmitterChain,
|
||||||
|
EmitterAddress: v.EmitterAddress,
|
||||||
Payload: v.Payload,
|
Payload: v.Payload,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,10 +114,16 @@ func (s *SolanaWatcher) Run(ctx context.Context) error {
|
||||||
Filters: []rpc.RPCFilter{
|
Filters: []rpc.RPCFilter{
|
||||||
{
|
{
|
||||||
Memcmp: &rpc.RPCFilterMemcmp{
|
Memcmp: &rpc.RPCFilterMemcmp{
|
||||||
Offset: 0, // Offset of VaaTime
|
Offset: 0, // Start of the account
|
||||||
Bytes: solana.Base58{'m', 's', 'g'}, // Prefix of the posted message accounts
|
Bytes: solana.Base58{'m', 's', 'g'}, // Prefix of the posted message accounts
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Memcmp: &rpc.RPCFilterMemcmp{
|
||||||
|
Offset: 4, // Offset of VaaTime
|
||||||
|
Bytes: solana.Base58{0, 0, 0, 0}, // This means this VAA hasn't been signed yet
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
queryLatency.WithLabelValues("get_program_accounts").Observe(time.Since(start).Seconds())
|
queryLatency.WithLabelValues("get_program_accounts").Observe(time.Since(start).Seconds())
|
||||||
|
@ -158,7 +164,7 @@ func (s *SolanaWatcher) Run(ctx context.Context) error {
|
||||||
Timestamp: time.Unix(int64(proposal.SubmissionTime), 0),
|
Timestamp: time.Unix(int64(proposal.SubmissionTime), 0),
|
||||||
Nonce: proposal.Nonce,
|
Nonce: proposal.Nonce,
|
||||||
Sequence: proposal.Sequence,
|
Sequence: proposal.Sequence,
|
||||||
EmitterChain: proposal.EmitterChain,
|
EmitterChain: vaa.ChainIDSolana,
|
||||||
EmitterAddress: proposal.EmitterAddress,
|
EmitterAddress: proposal.EmitterAddress,
|
||||||
Payload: proposal.Payload,
|
Payload: proposal.Payload,
|
||||||
}
|
}
|
||||||
|
@ -188,7 +194,7 @@ type (
|
||||||
SubmissionTime uint32
|
SubmissionTime uint32
|
||||||
Nonce uint32
|
Nonce uint32
|
||||||
Sequence uint64
|
Sequence uint64
|
||||||
EmitterChain vaa.ChainID
|
EmitterChain uint16
|
||||||
EmitterAddress vaa.Address
|
EmitterAddress vaa.Address
|
||||||
Payload []byte
|
Payload []byte
|
||||||
}
|
}
|
||||||
|
@ -196,7 +202,8 @@ type (
|
||||||
|
|
||||||
func ParseTransferOutProposal(data []byte) (*MessagePublicationAccount, error) {
|
func ParseTransferOutProposal(data []byte) (*MessagePublicationAccount, error) {
|
||||||
prop := &MessagePublicationAccount{}
|
prop := &MessagePublicationAccount{}
|
||||||
if err := borsh.Deserialize(prop, data); err != nil {
|
// Skip the b"msg" prefix
|
||||||
|
if err := borsh.Deserialize(prop, data[3:]); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ pub struct PostedMessageData {
|
||||||
impl Owned for PostedMessage {
|
impl Owned for PostedMessage {
|
||||||
fn owner(&self) -> AccountOwner {
|
fn owner(&self) -> AccountOwner {
|
||||||
AccountOwner::Other(
|
AccountOwner::Other(
|
||||||
Pubkey::from_str("96RHG3mfcckmrYN1UhmJzyS1XX3fZKbkeUcpJe9Sy3FE").unwrap(),
|
Pubkey::from_str("Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o").unwrap(),
|
||||||
) // TODO key of the bridge
|
) // TODO key of the bridge
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue