Skip to content

Commit

Permalink
fix: release conflicts (icon-project#765)
Browse files Browse the repository at this point in the history
* fix: ibc query method get consensus state by height should return any type (icon-project#727)

* patch: ibc query method get consensus state by height should return any type

* fix: add uniformity

* feat: remove xcall multi submodule (icon-project#733)

* fix: remove xcall submodule

* refactor: update test execution script

* fix: update documentation

* feat: save write ack event height (icon-project#734)

* feat: save write ack event height

* chore: style fixes

Signed-off-by: Night Owl <[email protected]>

* fix: add test case

---------

Signed-off-by: Night Owl <[email protected]>
Co-authored-by: viveksharmapoudel <[email protected]>
Co-authored-by: Night Owl <[email protected]>

* feat: test multiple packets on same height (icon-project#736)

* add(test): multiple packets on same heigt

* rf: simplfy recursion call

* ci: remove cw_common from inside the docker container (icon-project#712)

Signed-off-by: Night Owl <[email protected]>

* chore: exclude cosmwasm library and common file from contract deployment (icon-project#698)

---------

Signed-off-by: Night Owl <[email protected]>
Co-authored-by: Debendra Oli <[email protected]>
Co-authored-by: Night Owl <[email protected]>
Co-authored-by: DeepakBomjan <[email protected]>

* feat: add write ack log (icon-project#700)

* feat: add write ack log

* chore: pass build

---------

Co-authored-by: sabinchitrakar <[email protected]>

* fix: point to xcall tag (icon-project#738)

* fix: point to xcall tag

* fix: xcall contract build script

---------

Co-authored-by: red__larva <[email protected]>

* fix: address decoding on fee claim (icon-project#741)

* fix: do not send fund to ibc core on send_call_message (icon-project#740)

* fix: do not send fund to ibc host on send call message

* fix: unit test

---------

Co-authored-by: ibrizsabin <[email protected]>

* feat: Add artifact checksum in release (icon-project#742)

* chore: pass build

* ci: cleanup release artifacts upload
* dynamically fetch wasm version
* chore: cleanup redundant steps from the workflow

---------

Co-authored-by: ibrizsabin <[email protected]>

* ci: fix download error (icon-project#744)

* ci: revert release workflow changes (icon-project#746)

* ci: debug

* ci: debug

* ci: revert release workflow changes

* fix: call update admin (icon-project#751)

* fix: call-update-admin

* chore: pass build

* ci: update release build tag format (icon-project#758)

ci: trigger release action on any tag format and enable release

* fix: merge release (icon-project#759)

* ci: remove cw_common from inside the docker container (icon-project#712)

Signed-off-by: Night Owl <[email protected]>

* feat: cw-mock-ibc-connection added (icon-project#711)

* feat/cw-mock-ibc-connection added

* feat: mock xcall connection added

* fix: cargo lints fixes

* fix: mock xcall connection functionality reduced

* fix: cargo lints fixes

* chore: exclude cosmwasm library and common file from contract deployment (icon-project#698)

* fix: fee check added in sendMessage (icon-project#684)

* fix: funds compare issue

* fix: fee check added in sendMessage

* style: caro lints fixes

* feat: unit test for funds in send message added

* chore: cargo lints fixes

* fix: funds compare issue

* fix: fee check added in sendMessage

* style: caro lints fixes

* feat: unit test for funds in send message added

* chore: cargo lints fixes

* fix: bug fixed in send message funds test

* fix: cargo lints fixes

* fix: owner check removed in addAdmin in xcall-mock-connection (icon-project#715)

* fix: admin and owner state changed to Addr, and corresponding tests fixed (icon-project#687)

* admin and owner state changed to Addr, and corresponding tests fixed

* style: caro lints fixes

* Revert "style: caro lints fixes"

This reverts commit 755c628.

* fix: cargo lints fixes

---------

Co-authored-by: ibrizsabin <[email protected]>

* fix: remove_admin and update_owner, update_admin are removed (icon-project#692)

* fix: remove_admin and update_owner is removed, and created a method for update_admin

* fix: transfer admin removed and add_admin updated

* fix: transfer admin removed and add_admin updated

* fix: add_owner_unauthorized removed

* ci: add terraform deployment script (icon-project#750)

* ci: add terraform deployment script

* ci: update instance tag value

* ci: fix goloop command not found by adding goloop bin path in sudo secure path

* ci: cleanup deployment script

* ci: restrict keystore directory

* ci: update permission

* ci: make secret files inaccessable to other users (icon-project#753)

* ci: make secret files inaccessable to other users

* ci: fix permission

* ci: fix typo (icon-project#756)

* fix: update admin tests

* chore: pass build

---------

Signed-off-by: Night Owl <[email protected]>
Co-authored-by: Night Owl <[email protected]>
Co-authored-by: gcranju <[email protected]>
Co-authored-by: DeepakBomjan <[email protected]>

---------

Signed-off-by: Night Owl <[email protected]>
Co-authored-by: viveksharmapoudel <[email protected]>
Co-authored-by: redlarva <[email protected]>
Co-authored-by: izyak <[email protected]>
Co-authored-by: Night Owl <[email protected]>
Co-authored-by: Debendra Oli <[email protected]>
Co-authored-by: Night Owl <[email protected]>
Co-authored-by: DeepakBomjan <[email protected]>
Co-authored-by: sabinchitrakar <[email protected]>
Co-authored-by: red__larva <[email protected]>
Co-authored-by: gcranju <[email protected]>
  • Loading branch information
11 people authored Oct 4, 2023
1 parent a941a99 commit 49ff4ad
Show file tree
Hide file tree
Showing 42 changed files with 568 additions and 232 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Pre-release
on:
push:
tags:
- 'v*.*.*-alpha.*'
- '*'
permissions:
contents: write
packages: write
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
body: |
${{ steps.Changelog.outputs.changelog }}
draft: false
prerelease: true
prerelease: false

- name: Upload Javascore contracts to release
uses: svenstaro/upload-release-action@v2
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,6 @@ lcov.info
vendor/**
scripts/download_buf.sh

test/e2e-demo/ibc-config/**
test/e2e-demo/ibc-config/**

.xcall-multi
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
[submodule "contracts/javascore/gochain-btp"]
path = contracts/javascore/gochain-btp
url = https://github.com/izyak/gochain-btp.git

[submodule "xcall-multi"]
path = xcall-multi
url = https://github.com/icon-project/xcall-multi.git
branch = main

60 changes: 47 additions & 13 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ cosmwasm-storage = "1.2.2"
cosmwasm-schema = "1.2.2"
schemars = "0.8.12"
cw-storage-plus = {git="https://github.com/icon-project/cw-storage-plus.git", branch="fix-raw"}
cw-xcall-lib={package="cw-xcall-lib", git="https://github.com/icon-project/xCall.git", branch="main"}
cw-xcall = {package="cw-xcall", git="https://github.com/icon-project/xCall.git", branch="main"}
cw-mock-dapp = { git="https://github.com/icon-project/xCall.git", branch="main" }
cw-mock-dapp-multi = { git="https://github.com/icon-project/xCall.git", branch="main" }
cw-xcall-lib={package="cw-xcall-lib", git="https://github.com/icon-project/xCall.git", tag="v0.1.0-alpha.5"}
cw-xcall = {package="cw-xcall", git="https://github.com/icon-project/xCall.git", tag="v0.1.0-alpha.5"}
cw-mock-dapp = { git="https://github.com/icon-project/xCall.git", tag="v0.1.0-alpha.5" }
cw-mock-dapp-multi = { git="https://github.com/icon-project/xCall.git", tag="v0.1.0-alpha.5" }
cw2 = "1.0.1"

ibc-proto = { version = "0.26.0", default-features = false}
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
DOCKER := $(shell which docker)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf:1.9.0
PROJECT_NAME = $(shell git remote get-url origin | xargs basename -s .git)

BRANCH ?= "main"
export GO111MODULE = on


Expand Down Expand Up @@ -44,20 +44,20 @@ build-builder-img:

optimize-jar:
@echo "Generating optimized jar for ICON contracts"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerBuilder}-icon$$"; then docker start -a "${containerBuilder}-icon" ; else docker run --name "${containerBuilder}-icon" -v $(CURDIR):/workspace --workdir /workspace $(builderImage) sh ./scripts/optimize-jar.sh; fi
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerBuilder}-icon$$"; then docker start -a "${containerBuilder}-icon" ; else docker run --name "${containerBuilder}-icon" -v $(CURDIR):/workspace --workdir /workspace $(builderImage) bash ./scripts/optimize-jar.sh; fi

optimize-cosmwasm:
@echo "Generating optimized cosmwasm for Archway contracts"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerBuilder}-cosmwasm$$"; then docker start -a "${containerBuilder}-cosmwasm" ; else docker run --name "${containerBuilder}-cosmwasm" -v $(CURDIR):/workspace --workdir /workspace $(builderImage) sh ./scripts/optimize-cosmwasm.sh; fi
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerBuilder}-cosmwasm$$"; then docker start -a "${containerBuilder}-cosmwasm" ; else docker run --name "${containerBuilder}-cosmwasm" -v $(CURDIR):/workspace --workdir /workspace $(builderImage) bash ./scripts/optimize-cosmwasm.sh; fi

optimize-xcall:
@echo "Generating optimized xcall cosmwasm for Archway contracts"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerBuilder}-xcall$$"; then docker start -a "${containerBuilder}-xcall" ; else docker run --name "${containerBuilder}-xcall" -v $(CURDIR):/workspace --workdir /workspace $(builderImage) sh ./scripts/build-xcall.sh; fi
@echo "Generating optimized xcall contracts ..."
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerBuilder}-xcall$$"; then docker start -a "${containerBuilder}-xcall" ; else docker run --name "${containerBuilder}-xcall" -v $(CURDIR):/workspace --workdir /workspace $(builderImage) bash ./scripts/optimize-xcall-build.sh build $(BRANCH); fi


optimize-build:
@echo "Generating optimized contracts..."
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerBuilder}$$"; then docker start -a ${containerBuilder}; else docker run --name $(containerBuilder) -v $(CURDIR):/workspace --workdir /workspace $(builderImage) sh ./scripts/optimize-build.sh; fi
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerBuilder}$$"; then docker start -a ${containerBuilder}; else docker run --name $(containerBuilder) -v $(CURDIR):/workspace --workdir /workspace $(builderImage) bash ./scripts/optimize-build.sh build; fi

gobuild:
go build .
Expand All @@ -75,4 +75,4 @@ e2e-demo-clean:
go test -v ./test/e2e-demo -testify.m TestCleanup


.PHONY: proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps gobuild
.PHONY: proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps gobuild optimize-build optimize-xcall e2e-demo-setup e2e-demo-clean
7 changes: 7 additions & 0 deletions contracts/cosmwasm-vm/cw-common/src/core_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,11 @@ pub enum QueryMsg {
},
#[returns(Vec<u64>)]
GetPreviousConsensusStateHeight { client_id: String, height: u64 },
#[returns(HashMap<u64,u64>)]
GetAckHeights {
port_id: String,
channel_id: String,
start_sequence: u64,
end_sequence: u64,
},
}
14 changes: 14 additions & 0 deletions contracts/cosmwasm-vm/cw-ibc-core/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ impl<'a> CwIbcCoreContext<'a> {
return self.ibc_store().callback_data().remove(store, id);
}

pub fn store_write_ack(
&self,
store: &mut dyn Storage,
port_id: &PortId,
channel_id: &ChannelId,
seq: u64,
height: u64,
) -> Result<(), ContractError> {
self.ibc_store()
.write_acks()
.save(store, (port_id, channel_id, seq), &height)
.map_err(ContractError::Std)
}

pub fn get_callback_data<T: DeserializeOwned>(
&self,
store: &dyn Storage,
Expand Down
28 changes: 24 additions & 4 deletions contracts/cosmwasm-vm/cw-ibc-core/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl<'a> CwIbcCoreContext<'a> {
} => {
cw_println!(deps, "[IBCCore] Write Acknowledgement Called");
let ack = acknowledgement.to_bytes()?;
self.write_acknowledgement(deps, info, packet, ack)
self.write_acknowledgement(deps, info, &env, packet, ack)
}
}
// Ok(Response::new())
Expand Down Expand Up @@ -290,10 +290,10 @@ impl<'a> CwIbcCoreContext<'a> {
let client_val = IbcClientId::from_str(&client_id).unwrap();
let client = self.get_light_client(deps.storage, &client_val).unwrap();
let res = client
.get_consensus_state(deps, &client_val, height)
.get_consensus_state_any(deps, &client_val, height)
.unwrap();
let state = res.as_bytes();
to_binary(&hex::encode(state))

to_binary(&hex::encode(res.encode_to_vec()))
}
QueryMsg::GetClientState { client_id } => {
let res = self
Expand Down Expand Up @@ -475,6 +475,26 @@ impl<'a> CwIbcCoreContext<'a> {
.unwrap();
to_binary(&heights)
}
QueryMsg::GetAckHeights {
port_id,
channel_id,
start_sequence,
end_sequence,
} => {
let port_id = IbcPortId::from_str(&port_id).unwrap();
let channel_id = IbcChannelId::from_str(&channel_id).unwrap();
let heights = self
.ibc_store()
.get_ack_heights(
deps.storage,
&port_id,
&channel_id,
start_sequence,
end_sequence,
)
.unwrap();
to_binary(&heights)
}

QueryMsg::GetMissingPacketReceipts {
port_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ impl<'a> CwIbcCoreContext<'a> {
&self,
deps: DepsMut,
info: MessageInfo,
env: &Env,
packet: CwPacket,
ack: Vec<u8>,
) -> Result<Response, ContractError> {
Expand Down Expand Up @@ -47,6 +48,8 @@ impl<'a> CwIbcCoreContext<'a> {
Sequence::from(seq),
AcknowledgementCommitment::from(ack_commitment),
)?;
let height = env.block.height;
self.store_write_ack(deps.storage, &ibc_port, &ibc_channel, seq, height)?;

let event = create_packet_event(
IbcEventType::WriteAck,
Expand Down
28 changes: 28 additions & 0 deletions contracts/cosmwasm-vm/cw-ibc-core/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pub struct CwIbcStore<'a> {
// Stores data by replyid to be used later on reply from cross contract call
callback_data: Map<'a, u64, Vec<u8>>,
sent_packets: Map<'a, (&'a PortId, &'a ChannelId, u64), u64>,
write_acks: Map<'a, (&'a PortId, &'a ChannelId, u64), u64>,
}

impl<'a> Default for CwIbcStore<'a> {
Expand Down Expand Up @@ -147,6 +148,7 @@ impl<'a> CwIbcStore<'a> {
last_processed_on: Map::new(StorageKey::LastProcessedOn.as_str()),
callback_data: Map::new(StorageKey::CallbackData.as_str()),
sent_packets: Map::new(StorageKey::SentPackets.as_str()),
write_acks: Map::new(StorageKey::WriteAcks.as_str()),
}
}
pub fn client_registry(&self) -> &Map<'a, IbcClientType, String> {
Expand Down Expand Up @@ -214,6 +216,10 @@ impl<'a> CwIbcStore<'a> {
&self.sent_packets
}

pub fn write_acks(&self) -> &Map<'a, (&'a PortId, &'a ChannelId, u64), u64> {
&self.write_acks
}

pub fn clear_storage(&self, store: &mut dyn Storage) {
let keys: Vec<_> = store
.range(None, None, Order::Ascending)
Expand Down Expand Up @@ -290,6 +296,28 @@ impl<'a> CwIbcStore<'a> {
Ok(missing)
}

pub fn get_ack_heights(
&self,
store: &dyn Storage,
port_id: &PortId,
channel_id: &ChannelId,
start_seq: u64,
end_seq: u64,
) -> Result<HashMap<u64, u64>, ContractError> {
let min_key = (port_id, channel_id, start_seq);
let max_key = (port_id, channel_id, end_seq);
let min_bound = Bound::Inclusive::<(&PortId, &ChannelId, u64)>((min_key, PhantomData));
let max_bound = Bound::Inclusive::<(&PortId, &ChannelId, u64)>((max_key, PhantomData));

let result: HashMap<u64, u64> = self
.write_acks
.range(store, Some(min_bound), Some(max_bound), Order::Ascending)
.filter_map(|p| p.ok().map(|r| (r.0 .2, r.1)))
.collect();

Ok(result)
}

pub fn save_commitment(
&self,
store: &mut dyn Storage,
Expand Down
Loading

0 comments on commit 49ff4ad

Please sign in to comment.