Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge dev16 master #1260

Merged
merged 3 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ rm -r ~/.paloma/data/wasm/cache
### To get the latest prebuilt `palomad` binary

```shell
wget -O - https://github.com/palomachain/paloma/releases/download/v1.15.6/paloma_Linux_x86_64.tar.gz | \
wget -O - https://github.com/palomachain/paloma/releases/download/v1.15.7/paloma_Linux_x86_64.tar.gz | \
sudo tar -C /usr/local/bin -xvzf - palomad
sudo chmod +x /usr/local/bin/palomad
```
Expand All @@ -108,7 +108,7 @@ sudo chmod +x /usr/local/bin/palomad
```shell
git clone https://github.com/palomachain/paloma.git
cd paloma
git checkout v1.15.6
git checkout v1.15.7
make build
sudo mv ./build/palomad /usr/local/bin/palomad
```
Expand Down
5 changes: 2 additions & 3 deletions x/evm/keeper/attest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ var _ = g.Describe("attest router", func() {

g.When("target chain has no deployed ERC20 tokens", func() {
// g.BeforeEach(func() {
// gk.On("CastAllERC20ToDenoms", mock.Anything).Return(nil, nil)
// gk.On("CastChainERC20ToDenoms", mock.Anything, mock.Anything).Return(nil, nil)
// })
g.It("removes deployment", func() {
setupChainSupport()
Expand All @@ -603,10 +603,9 @@ var _ = g.Describe("attest router", func() {

// g.When("target chain has active ERC20 tokens deployed", func() {
// g.BeforeEach(func() {
// gk.On("CastAllERC20ToDenoms", mock.Anything).Return([]types.ERC20Record{
// gk.On("CastChainERC20ToDenoms", mock.Anything, newChain.ChainReferenceID).Return([]types.ERC20Record{
// record{"denom", "address1", newChain.ChainReferenceID},
// record{"denom2", "address2", newChain.ChainReferenceID},
// record{"denom3", "address3", "unknown-chain"},
// }, nil)
// })
// g.It("updates deployment", func() {
Expand Down
20 changes: 14 additions & 6 deletions x/evm/keeper/attest_upload_smart_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ func (a *uploadSmartContractAttester) attest(ctx sdk.Context, evidence *types.Tx
// We need to reenable this in v1.16.1 after compass 2.0 is deployed.
// See https://github.com/VolumeFi/paloma/issues/1891
//
// records, err := a.k.Skyway.CastAllERC20ToDenoms(ctx)
// Get the ERC20 tokens just for this chain
// records, err := a.k.Skyway.CastChainERC20ToDenoms(ctx, a.chainReferenceID)
// if err != nil {
// a.logger.WithError(err).Error("Failed to extract ERC20 records.")
// return err
Expand Down Expand Up @@ -212,11 +213,18 @@ func (a *uploadSmartContractAttester) attest(ctx sdk.Context, evidence *types.Tx
// })
// }

// deployment.Erc20Transfers = transfers
// if err := a.k.updateSmartContractDeployment(ctx, smartContractID, a.chainReferenceID, deployment); err != nil {
// a.logger.WithError(err).Error("Failed to update smart contract deployment")
// return err
// }
// // This shouldn't be needed anymore, since we query the ERC20 tokens for
// // this specific chain. However, just to make double sure, we check the
// // transfers. If there's none, just set the contract to active.
// if len(transfers) == 0 {
// return a.k.SetSmartContractAsActive(ctx, smartContractID, a.chainReferenceID)
// }

// deployment.Erc20Transfers = transfers
// if err := a.k.updateSmartContractDeployment(ctx, smartContractID, a.chainReferenceID, deployment); err != nil {
// a.logger.WithError(err).Error("Failed to update smart contract deployment")
// return err
// }

// a.k.deploymentCache.Add(ctx, a.chainReferenceID, smartContractID, msgIDs...)
// a.logger.Debug("attestation successful")
Expand Down
1 change: 1 addition & 0 deletions x/evm/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type ERC20Record interface {
type SkywayKeeper interface {
GetLastObservedSkywayNonce(ctx context.Context, chainReferenceID string) (uint64, error)
CastAllERC20ToDenoms(ctx context.Context) ([]ERC20Record, error)
CastChainERC20ToDenoms(ctx context.Context, chainReferenceID string) ([]ERC20Record, error)
}

//go:generate mockery --name=MetrixKeeper
Expand Down
33 changes: 31 additions & 2 deletions x/evm/types/mocks/SkywayKeeper.go

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

19 changes: 19 additions & 0 deletions x/skyway/keeper/cosmos-originated.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,25 @@ func (k Keeper) CastAllERC20ToDenoms(ctx context.Context) ([]evmtypes.ERC20Recor
return cast, nil
}

func (k Keeper) CastChainERC20ToDenoms(
ctx context.Context,
chainReferenceID string,
) ([]evmtypes.ERC20Record, error) {
all, err := k.GetAllERC20ToDenoms(ctx)
if err != nil {
return nil, err
}

cast := make([]evmtypes.ERC20Record, 0, len(all))
for _, v := range all {
if v.GetChainReferenceId() == chainReferenceID {
cast = append(cast, v)
}
}

return cast, nil
}

func (k Keeper) setDenomToERC20(ctx context.Context, chainReferenceId, denom string, tokenContract types.EthAddress) error {
store := k.GetStore(ctx, types.StoreModulePrefix)

Expand Down
Loading