Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: palomachain/pigeon
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 18bf8341ccca2c0c6d6af32702ff64c4b39eda7a
Choose a base ref
..
head repository: palomachain/pigeon
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ec084f418020839fa1275723a8e2368c494b93d6
Choose a head ref
6 changes: 0 additions & 6 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
@@ -35,9 +35,3 @@ jobs:
# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
skip-build-cache: true
14 changes: 7 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ import (
"github.com/cosmos/gogoproto/proto"
consensustypes "github.com/palomachain/paloma/x/consensus/types"
evmtypes "github.com/palomachain/paloma/x/evm/types"
gravitytypes "github.com/palomachain/paloma/x/gravity/types"
palomatypes "github.com/palomachain/paloma/x/paloma/types"
skywaytypes "github.com/palomachain/paloma/x/skyway/types"
valsettypes "github.com/palomachain/paloma/x/valset/types"
"github.com/palomachain/pigeon/chain/evm"
"github.com/palomachain/pigeon/chain/paloma"
@@ -189,12 +189,12 @@ func palomaClientConfig(palomaConfig config.Paloma) *ion.ChainClientConfig {
&consensustypes.MsgSetPublicAccessData{},
&consensustypes.MsgSetErrorData{},
&palomatypes.MsgAddStatusUpdate{},
&gravitytypes.MsgSendToEth{},
&gravitytypes.MsgConfirmBatch{},
&gravitytypes.MsgSendToPalomaClaim{},
&gravitytypes.MsgBatchSendToEthClaim{},
&gravitytypes.MsgCancelSendToEth{},
&gravitytypes.MsgSubmitBadSignatureEvidence{},
&skywaytypes.MsgSendToEth{},
&skywaytypes.MsgConfirmBatch{},
&skywaytypes.MsgSendToPalomaClaim{},
&skywaytypes.MsgBatchSendToEthClaim{},
&skywaytypes.MsgCancelSendToEth{},
&skywaytypes.MsgSubmitBadSignatureEvidence{},
},
},
{
10 changes: 5 additions & 5 deletions chain/evm/client.go
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/event"
"github.com/palomachain/paloma/x/evm/types"
gravitytypes "github.com/palomachain/paloma/x/gravity/types"
skywaytypes "github.com/palomachain/paloma/x/skyway/types"
valset "github.com/palomachain/paloma/x/valset/types"
compassABI "github.com/palomachain/pigeon/chain/evm/abi/compass"
"github.com/palomachain/pigeon/chain/paloma"
@@ -109,10 +109,10 @@ type PalomaClienter interface {
SetPublicAccessData(ctx context.Context, queueTypeName string, messageID uint64, data []byte) error
SetErrorData(ctx context.Context, queueTypeName string, messageID uint64, data []byte) error
QueryGetEVMValsetByID(ctx context.Context, id uint64, chainID string) (*types.Valset, error)
SendBatchSendToEVMClaim(ctx context.Context, claim gravitytypes.MsgBatchSendToEthClaim) error
SendSendToPalomaClaim(ctx context.Context, claim gravitytypes.MsgSendToPalomaClaim) error
QueryLastObservedGravityNonceByAddr(ctx context.Context, chainReferenceID string, orchestrator string) (uint64, error)
QueryBatchRequestByNonce(ctx context.Context, nonce uint64, contract string) (gravitytypes.OutgoingTxBatch, error)
SendBatchSendToEVMClaim(ctx context.Context, claim skywaytypes.MsgBatchSendToEthClaim) error
SendSendToPalomaClaim(ctx context.Context, claim skywaytypes.MsgSendToPalomaClaim) error
QueryLastObservedSkywayNonceByAddr(ctx context.Context, chainReferenceID string, orchestrator string) (uint64, error)
QueryBatchRequestByNonce(ctx context.Context, nonce uint64, contract string) (skywaytypes.OutgoingTxBatch, error)
QueryGetLatestPublishedSnapshot(ctx context.Context, chainReferenceID string) (*valset.Snapshot, error)
}

51 changes: 25 additions & 26 deletions chain/evm/compass.go
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/rpc"
evmtypes "github.com/palomachain/paloma/x/evm/types"
gravitytypes "github.com/palomachain/paloma/x/gravity/types"
skywaytypes "github.com/palomachain/paloma/x/skyway/types"
"github.com/palomachain/pigeon/chain"
"github.com/palomachain/pigeon/internal/ethfilter"
"github.com/palomachain/pigeon/internal/liblog"
@@ -367,15 +367,14 @@ func (t compass) isArbitraryCallAlreadyExecuted(ctx context.Context, messageID u

return found
})

if err != nil {
return false, err
}

return found, nil
}

func (t compass) gravityIsBatchAlreadyRelayed(ctx context.Context, batchNonce uint64) (bool, error) {
func (t compass) skywayIsBatchAlreadyRelayed(ctx context.Context, batchNonce uint64) (bool, error) {
filter, err := ethfilter.Factory().
WithFromBlockNumberProvider(t.evm.FindCurrentBlockNumber).
WithFromBlockNumberSafetyMargin(9999).
@@ -701,7 +700,7 @@ func (t *compass) GetBatchSendEvents(ctx context.Context, orchestrator string) (
return nil, err
}

lastGravityNonce, err := t.paloma.QueryLastObservedGravityNonceByAddr(ctx, t.ChainReferenceID, orchestrator)
lastSkywayNonce, err := t.paloma.QueryLastObservedSkywayNonceByAddr(ctx, t.ChainReferenceID, orchestrator)
if err != nil {
return nil, err
}
@@ -722,18 +721,18 @@ func (t *compass) GetBatchSendEvents(ctx context.Context, orchestrator string) (
return nil, fmt.Errorf("invalid batch nonce")
}

gravityNonce, ok := event[2].(*big.Int)
skywayNonce, ok := event[2].(*big.Int)
if !ok {
return nil, fmt.Errorf("invalid gravity nonce")
return nil, fmt.Errorf("invalid skyway nonce")
}

eventNonce, ok := event[3].(*big.Int)
if !ok {
return nil, fmt.Errorf("invalid event nonce")
}

if gravityNonce.Uint64() <= lastGravityNonce {
liblog.WithContext(ctx).WithField("last-event-nonce", lastGravityNonce).WithField("gravity-nonce", gravityNonce.Uint64()).Info("Skipping already observed event...")
if skywayNonce.Uint64() <= lastSkywayNonce {
liblog.WithContext(ctx).WithField("last-event-nonce", lastSkywayNonce).WithField("skyway-nonce", skywayNonce.Uint64()).Info("Skipping already observed event...")
continue
}

@@ -742,7 +741,7 @@ func (t *compass) GetBatchSendEvents(ctx context.Context, orchestrator string) (
EventNonce: eventNonce.Uint64(),
BatchNonce: batchNonce.Uint64(),
TokenContract: tokenContract.String(),
GravityNonce: gravityNonce.Uint64(),
SkywayNonce: skywayNonce.Uint64(),
})
}

@@ -777,7 +776,7 @@ func (t *compass) GetSendToPalomaEvents(ctx context.Context, orchestrator string
return nil, err
}

lastGravityNonce, err := t.paloma.QueryLastObservedGravityNonceByAddr(ctx, t.ChainReferenceID, orchestrator)
lastSkywayNonce, err := t.paloma.QueryLastObservedSkywayNonceByAddr(ctx, t.ChainReferenceID, orchestrator)
if err != nil {
return nil, err
}
@@ -808,7 +807,7 @@ func (t *compass) GetSendToPalomaEvents(ctx context.Context, orchestrator string
return nil, fmt.Errorf("invalid amount")
}

gravityNonce, ok := event[4].(*big.Int)
skywayNonce, ok := event[4].(*big.Int)
if !ok {
return nil, fmt.Errorf("invalid paloma nonce")
}
@@ -818,8 +817,8 @@ func (t *compass) GetSendToPalomaEvents(ctx context.Context, orchestrator string
return nil, fmt.Errorf("invalid event nonce")
}

if gravityNonce.Uint64() <= lastGravityNonce {
liblog.WithContext(ctx).WithField("last-event-nonce", lastGravityNonce).WithField("gravity-nonce", gravityNonce.Uint64()).Info("Skipping already observed event...")
if skywayNonce.Uint64() <= lastSkywayNonce {
liblog.WithContext(ctx).WithField("last-event-nonce", lastSkywayNonce).WithField("skyway-nonce", skywayNonce.Uint64()).Info("Skipping already observed event...")
continue
}

@@ -830,7 +829,7 @@ func (t *compass) GetSendToPalomaEvents(ctx context.Context, orchestrator string
EthereumSender: ethSender.String(),
PalomaReceiver: palomaReceiver,
TokenContract: tokenContract.String(),
GravityNonce: gravityNonce.Uint64(),
SkywayNonce: skywayNonce.Uint64(),
})
}

@@ -863,20 +862,20 @@ func (t compass) provideTxProof(ctx context.Context, queueTypeName string, rawMs
}

func (t compass) submitBatchSendToEVMClaim(ctx context.Context, event chain.BatchSendEvent, orchestrator string) error {
msg := gravitytypes.MsgBatchSendToEthClaim{
msg := skywaytypes.MsgBatchSendToEthClaim{
EventNonce: event.EventNonce,
EthBlockHeight: event.EthBlockHeight,
BatchNonce: event.BatchNonce,
TokenContract: event.TokenContract,
ChainReferenceId: t.ChainReferenceID,
Orchestrator: orchestrator,
GravityNonce: event.GravityNonce,
SkywayNonce: event.SkywayNonce,
}
return t.paloma.SendBatchSendToEVMClaim(ctx, msg)
}

func (t compass) submitSendToPalomaClaim(ctx context.Context, event chain.SendToPalomaEvent, orchestrator string) error {
msg := gravitytypes.MsgSendToPalomaClaim{
msg := skywaytypes.MsgSendToPalomaClaim{
EventNonce: event.EventNonce,
EthBlockHeight: event.EthBlockHeight,
TokenContract: event.TokenContract,
@@ -885,7 +884,7 @@ func (t compass) submitSendToPalomaClaim(ctx context.Context, event chain.SendTo
PalomaReceiver: event.PalomaReceiver,
ChainReferenceId: t.ChainReferenceID,
Orchestrator: orchestrator,
GravityNonce: event.GravityNonce,
SkywayNonce: event.SkywayNonce,
}
return t.paloma.SendSendToPalomaClaim(ctx, msg)
}
@@ -986,7 +985,7 @@ func (c compass) callCompass(
return c.evm.ExecuteSmartContract(ctx, c.chainID, *c.compassAbi, c.smartContractAddr, useMevRelay, method, arguments)
}

func (t compass) gravityRelayBatches(ctx context.Context, batches []chain.GravityBatchWithSignatures) error {
func (t compass) skywayRelayBatches(ctx context.Context, batches []chain.SkywayBatchWithSignatures) error {
var gErr whoops.Group
logger := liblog.WithContext(ctx).WithField("chainReferenceID", t.ChainReferenceID)
for _, batch := range batches {
@@ -1003,7 +1002,7 @@ func (t compass) gravityRelayBatches(ctx context.Context, batches []chain.Gravit
})
logger.Debug("relaying")

_, processingErr = t.gravityRelayBatch(ctx, batch)
_, processingErr = t.skywayRelayBatch(ctx, batch)

processingErr = whoops.Enrich(
processingErr,
@@ -1024,19 +1023,19 @@ func (t compass) gravityRelayBatches(ctx context.Context, batches []chain.Gravit
return gErr.Return()
}

func (t compass) gravityRelayBatch(
func (t compass) skywayRelayBatch(
ctx context.Context,
batch chain.GravityBatchWithSignatures,
batch chain.SkywayBatchWithSignatures,
) (*ethtypes.Transaction, error) {
return whoops.TryVal(func() *ethtypes.Transaction {
logger := liblog.WithContext(ctx).
WithField("component", "gravity-relay-batch").
WithField("gravity-batch-nonce", batch.BatchNonce).
WithField("component", "skyway-relay-batch").
WithField("skyway-batch-nonce", batch.BatchNonce).
WithField("chain-reference-id", batch.ChainReferenceId)
executed, err := t.gravityIsBatchAlreadyRelayed(ctx, batch.BatchNonce)
executed, err := t.skywayIsBatchAlreadyRelayed(ctx, batch.BatchNonce)
whoops.Assert(err)
if executed {
logger.Warn("gravity batch already executed!")
logger.Warn("skyway batch already executed!")
return nil
}

8 changes: 4 additions & 4 deletions chain/evm/mocks/PalomaClienter.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions chain/evm/processor.go
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import (
"github.com/VolumeFi/whoops"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
gravity "github.com/palomachain/paloma/x/gravity/types"
skyway "github.com/palomachain/paloma/x/skyway/types"
"github.com/palomachain/pigeon/chain"
"github.com/palomachain/pigeon/errors"
"github.com/palomachain/pigeon/internal/queue"
@@ -75,8 +75,8 @@ func (p Processor) SignMessages(ctx context.Context, messages ...chain.QueuedMes
)
}

func (p Processor) GravitySignBatches(ctx context.Context, batches ...gravity.OutgoingTxBatch) ([]chain.SignedGravityOutgoingTxBatch, error) {
return slice.MapErr(batches, func(batch gravity.OutgoingTxBatch) (chain.SignedGravityOutgoingTxBatch, error) {
func (p Processor) SkywaySignBatches(ctx context.Context, batches ...skyway.OutgoingTxBatch) ([]chain.SignedSkywayOutgoingTxBatch, error) {
return slice.MapErr(batches, func(batch skyway.OutgoingTxBatch) (chain.SignedSkywayOutgoingTxBatch, error) {
logger := log.WithFields(log.Fields{
"batch-nonce": batch.BatchNonce,
})
@@ -90,16 +90,16 @@ func (p Processor) GravitySignBatches(ctx context.Context, batches ...gravity.Ou
sig, err := p.evmClient.sign(ctx, msgBytes)
if err != nil {
logger.WithError(err).Error("signing a batch failed")
return chain.SignedGravityOutgoingTxBatch{}, err
return chain.SignedSkywayOutgoingTxBatch{}, err
}

logger.Info("signed a batch")

if err != nil {
return chain.SignedGravityOutgoingTxBatch{}, err
return chain.SignedSkywayOutgoingTxBatch{}, err
}

return chain.SignedGravityOutgoingTxBatch{
return chain.SignedSkywayOutgoingTxBatch{
OutgoingTxBatch: batch,
Signature: sig,
SignedByAddress: p.evmClient.addr.Hex(),
@@ -120,8 +120,8 @@ func (p Processor) ProcessMessages(ctx context.Context, queueTypeName queue.Type
)
}

func (p Processor) GravityRelayBatches(ctx context.Context, batches []chain.GravityBatchWithSignatures) error {
return p.compass.gravityRelayBatches(
func (p Processor) SkywayRelayBatches(ctx context.Context, batches []chain.SkywayBatchWithSignatures) error {
return p.compass.skywayRelayBatches(
ctx,
batches,
)
20 changes: 10 additions & 10 deletions chain/mocks/Processor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading