Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
48b163e
feat(sui): proper port parsing in voyager
aeryz Jun 2, 2025
f6460bb
chore(voyager): fix latest height vs exact bug
aeryz Jun 2, 2025
2963bec
chore(sui): work moar on the clients
aeryz Jun 2, 2025
048fdf9
chore(sui): bunch more changes
aeryz Jun 5, 2025
74f35c2
chore(sui): improve types
aeryz Jun 10, 2025
1d5b80e
chore(sui): minor fixes
aeryz Jun 10, 2025
e512ee4
chore(sui): voyager fixes
aeryz Jun 10, 2025
34c04de
chore(sui): voyager reads if the token exists before deploying it
aeryz Jun 10, 2025
e0da4c8
chore(sui): refactor voyager event source
aeryz Jun 11, 2025
a3d962e
chore(sui): add sui client type
aeryz Jun 14, 2025
d9cbbe3
feat(sui): add packet hash to digest for voyager
aeryz Jun 14, 2025
475b3e0
feat(sui): add smarter event fetching to voyager
aeryz Jul 1, 2025
b50915f
chore(sui): better lc handling
aeryz Jul 1, 2025
766a388
chore(sui): minor ibc fixes
aeryz Jul 2, 2025
72944c0
chore(sui): some fungible asset fixes
aeryz Jul 2, 2025
54f990c
chore(sui): impl batch opcode
aeryz Jul 2, 2025
5edec31
chore(sui): fix acks 1
aeryz Jul 3, 2025
ad3cd31
chore(sui): acknowledgements are done
aeryz Jul 3, 2025
83b4647
chore(sui): zkgm timeout implemented
aeryz Jul 3, 2025
f510519
chore(sui): verify_internal fixes
aeryz Jul 3, 2025
18d18fb
chore(sui): moar fixes
aeryz Jul 4, 2025
7cacda9
chore(sui): funky stuff with the type system
aeryz Jul 4, 2025
12ad733
chore(sui): put zkgm helpers into their own file
aeryz Jul 7, 2025
fe1b936
chore(sui): add metadata check to newly deployed tokens
aeryz Jul 7, 2025
c2d9a09
chore(sui): fix tests
aeryz Jul 7, 2025
eb50e98
chore(sui): add fungible asset metadata for ucs03
aeryz Jul 9, 2025
61142a7
chore(sui): zkgm fungible asset v2 stuff
aeryz Jul 9, 2025
6fc4dfa
chore(sui): add ack and timeout
aeryz Jul 10, 2025
b06d000
chore(sui): remove warnings
aeryz Jul 11, 2025
b91bff6
chore(sui): make sure all ucs03 types encode/decode correctly
aeryz Jul 11, 2025
3df8d6d
chore(sui): trying fungibleassetv2
aeryz Sep 8, 2025
811c1f7
chore(sui): major improvements to voyager tx plugin
aeryz Jul 12, 2025
1240bc9
chore(sui): multi-step execution
aeryz Aug 1, 2025
687a2cc
chore(sui): voyager multi-step execution phase 1
aeryz Aug 1, 2025
9baf4f1
chore(sui): voyager multi token register
aeryz Aug 4, 2025
6617ed0
chore(sui): trying split mechnaism in voyager
aeryz Aug 6, 2025
115cc74
chore(sui): still tryin the tx stuff
aeryz Aug 8, 2025
3fdf5ac
chore(sui): weird stuff happening
aeryz Aug 8, 2025
b0b5cc0
chore: contd
aeryz Aug 14, 2025
9b6b867
chore: super hacky encoding stuff
aeryz Aug 19, 2025
1b58f13
chore(sui): a ton of hacky optimizations to ethabi
aeryz Aug 21, 2025
99cd519
chore(sui): add more event handlings to voyager
aeryz Aug 21, 2025
65d256d
chore(sui): handle multi packets
aeryz Aug 22, 2025
bc49737
chore: executionctx storage is now a hot potato
aeryz Sep 6, 2025
57e18ff
chore(sui): ibc prevent double receive
aeryz Aug 25, 2025
be2ea3f
chore(sui): bunch of token order fixes again and again
aeryz Sep 8, 2025
0835e31
chore(sui): solver stuff
aeryz Sep 9, 2025
b8f0117
chore(sui): add token admin functions
aeryz Sep 9, 2025
4823a9d
chore(sui): bunch of improvements
aeryz Sep 10, 2025
4a67d20
chore(sui): much better tx module
aeryz Sep 10, 2025
a5a35b0
chore(sui): handle solve api in voyager
aeryz Sep 10, 2025
67cbd32
chore(sui): moar
aeryz Sep 11, 2025
654c6c2
chore(sui): multi-step ack
aeryz Sep 11, 2025
3e1a477
chore(sui): fully fix the acks
aeryz Sep 11, 2025
64784ab
chore(sui): transaction plugin handles multi-step ack
aeryz Sep 15, 2025
7ebee47
chore: fmt
aeryz Sep 15, 2025
57eabf1
chore(sui): fix clippy
aeryz Sep 15, 2025
124d7d2
chore(sui): final fixes
aeryz Sep 15, 2025
6d68961
chore: fix clippy
aeryz Sep 16, 2025
936edb4
chore: fix comments
aeryz Sep 17, 2025
415246d
chore: really fix clippy
aeryz Sep 17, 2025
48cb9bc
chore(sui): remove wasm-bindgen dependency
aeryz Sep 17, 2025
10a6081
chore: fmt
aeryz Sep 17, 2025
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ circuit.zip
r1cs.bin
vk.bin
pk.bin
r1cs-bls12381.bin
vk-bls12381.bin
pk-bls12381.bin

out
!./.vscode
Expand Down
8 changes: 6 additions & 2 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion cosmwasm/cosmwasm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ _: {
lightclients = [
# "sui"
# "trusted-mpt"
"parlia"
# "parlia"
"sui"
# "trusted-mpt"
];
}
{
Expand Down
2 changes: 1 addition & 1 deletion cosmwasm/ibc-union/lightclient/sui/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl IbcClient for SuiLightClient {
_key: Vec<u8>,
_storage_proof: Self::StorageProof,
) -> Result<(), ibc_union_light_client::IbcClientError<Self>> {
Ok(())
unimplemented!()
}

fn get_timestamp(consensus_state: &Self::ConsensusState) -> Timestamp {
Expand Down
2 changes: 1 addition & 1 deletion galoisd/grpc/bls12381_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (p *proverServerBls12381) Poll(ctx context.Context, pollReq *grpc.PollReque
return nil, fmt.Errorf("Witness err %s", err)
}

proof, err := backend.Prove(constraint.R1CS(&p.cs), backend.ProvingKey(&p.pk), privateWitness, backend_opts.WithProverHashToFieldFunction(&cometblsHashToField{}))
proof, err := backend.Prove(constraint.R1CS(&p.cs), backend.ProvingKey(&p.pk), privateWitness, backend_opts.WithProverHashToFieldFunction(&bls12381HashToField{}))
if err != nil {
return nil, fmt.Errorf("Could not prove %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion galoisd/pkg/lightclient/bls12381/circuit.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type Circuit struct {
CommitmentX frontend.Variable `gnark:",public"`
CommitmentY frontend.Variable `gnark:",public"`
InnerInputsHash frontend.Variable `gnark:",public"`
// VkHash frontend.Variable `gnark:",public"`
// OptimizedInnerWitness frontend.Variable `gnark:",public"`
// VkHash frontend.Variable `gnark:",public"`
}

func (c *Circuit) Define(api frontend.API) error {
Expand Down
10 changes: 5 additions & 5 deletions lib/gnark-key-parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ workspace = true

[dependencies]
ark-bls12-381 = { version = "0.4", default-features = false, features = ["curve"] }
ark-serialize = "0.4.2"
num-bigint = { workspace = true }
substrate-bn = { version = "0.6", default-features = false }
thiserror = { workspace = true }

[dev-dependencies]
ark-bn254 = { version = "0.4", default-features = false, features = ["curve"] }
ark-ff = { version = "0.4.2", default-features = false }
ark-serialize = "0.4.2"
hex = { workspace = true, features = ["alloc"] }
num-bigint = { workspace = true }
ark-bn254 = { version = "0.4", default-features = false, features = ["curve"] }
ark-ff = { version = "0.4.2", default-features = false }
hex = { workspace = true, features = ["alloc"] }
132 changes: 68 additions & 64 deletions lib/gnark-key-parser/src/bls12381.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
use ark_bls12_381::{G1Affine, G2Affine};
use ark_bls12_381::{Fq, Fq2, G1Affine, G2Affine};
use ark_serialize::{CanonicalSerialize, SerializationError, Valid};
use num_bigint::BigUint;

pub const G1_SIZE: usize = 48;
pub const G2_SIZE: usize = G1_SIZE * 2;

pub struct VerifyingKey {
/// The `alpha * G`, where `G` is the generator of `E::G1`.
Expand All @@ -20,82 +25,81 @@ pub struct PedersenVerifyingKey {
pub g_root_sigma_neg: G2Affine,
}

pub fn reencode_evm_zkp_for_sui(zkp: &[u8]) -> Result<Vec<u8>, SerializationError> {
let mut buf = Vec::new();

let serialize_g1 =
|cursor: &mut usize, buf: &mut Vec<u8>, zkp: &[u8]| -> Result<(), SerializationError> {
let proof = G1Affine::new_unchecked(
Fq::from(BigUint::from_bytes_be(&zkp[*cursor..*cursor + G1_SIZE])),
Fq::from(BigUint::from_bytes_be(
&zkp[*cursor + G1_SIZE..*cursor + (G1_SIZE * 2)],
)),
);
proof.check()?;
*cursor += G1_SIZE * 2;
proof.serialize_compressed(buf)?;
Ok(())
};

let serialize_g2 =
|cursor: &mut usize, buf: &mut Vec<u8>, zkp: &[u8]| -> Result<(), SerializationError> {
let proof = G2Affine::new_unchecked(
Fq2::new(
Fq::from(BigUint::from_bytes_be(
&zkp[*cursor + G1_SIZE..*cursor + (2 * G1_SIZE)],
)),
Fq::from(BigUint::from_bytes_be(&zkp[*cursor..*cursor + G1_SIZE])),
),
Fq2::new(
Fq::from(BigUint::from_bytes_be(
&zkp[*cursor + (G1_SIZE * 3)..*cursor + (G1_SIZE * 4)],
)),
Fq::from(BigUint::from_bytes_be(
&zkp[*cursor + (G1_SIZE * 2)..*cursor + (G1_SIZE * 3)],
)),
),
);
proof.check()?;
*cursor += G1_SIZE * 4;
proof.serialize_compressed(buf)?;
Ok(())
};

let mut cursor = 0;
// zkp.proof.a
serialize_g1(&mut cursor, &mut buf, zkp).unwrap();
// zkp.proof.b
serialize_g2(&mut cursor, &mut buf, zkp).unwrap();
// zkp.proof.c
serialize_g1(&mut cursor, &mut buf, zkp).unwrap();
// zkp.poc
serialize_g1(&mut cursor, &mut buf, zkp).unwrap();
// zkp.pok
serialize_g1(&mut cursor, &mut buf, zkp).unwrap();

buf.extend_from_slice(&zkp[cursor..]);

Ok(buf)
}

#[cfg(test)]
mod tests {

const G1_SIZE: usize = 48;
const G2_SIZE: usize = G1_SIZE * 2;

use ark_bls12_381::{Fq, Fq2};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError, Valid};
use num_bigint::BigUint;
use ark_serialize::CanonicalDeserialize;

use super::*;

#[test]
fn dump_sui_proof() {
let zkp = hex::decode("0A8FB8F6066E6956618158D1A61DD27C1B30C0CF6BA0E100E45E19E0F6CE48536406B028541DD1DB38B180615DFB7A050C55CCBE3D4C4ADCF4818E3A67BB186F67095D8BB8C60BC29F0C20B25421D3231260060DD63353B1D8BA96D140EAE02A1510808F24D1ABB6E491337614851D036B3D892953022BF81B185A7906455146338C7CAE98B4D3D213B64A6895780DFA065204820A3693C519AA2F556FDD8E538519A94164AC6C902DB630F07326565EE83C4ACA79C6C48AC9FA837BA22684C50886E74B93579D8270BD2918694FCBDF4FD834D30421E9FC8C81683BAC257F19A1D6D2B942B2CF7B5E2D30F1AD0A67AE0107171B1E46E25B1914A56446B4DCE9D4BFDC800CF688FD7FFA2B032AEFF6225BEC922740F8025ACBF949401BA586E11254BAEE94E80B8DE33C8E5382A94C4AFC84F3237966A93429E29AFC817D8369D552C53F3CFB5C7BF26452F5BC7B47AB157CC8E6B9CAC2B5FCA8C934B15960BA2AEAB017AB10E7D89C01B53B21B05AED12440C452EF69E0A2AAA5D10CE9D0C4509D68A72455778D02A30776150E97CC8A4C23FA3AD44ABE74699ECFA43108EB0951DA0778AEC9163FF0BA793C79A676C0F48884F44EB20D24E8E4599132EDB237C90E2DDFBB64CD9FBFB860F2226DED721117AA6AEF507C604314675F1160C780D3E9F262F2CBA70DD6EB812C524971B5C7379B510A6623DE8C2B10E2106CB167C15E45956FAF14F8539E47828A6A1C51123ED26609F6248370044143CCA0B322BEE55073828FB0B3ABA26393165A2F1A99A3AAFB3F47542F2FD1EDFA3CDCC731346E297892D74138BFEE2FCFEDBF421F5A000BD75CB87FECBCF5867DD715DC02CE84B6354099E089A6EE07A6A13922C37A4F08A8D28DE81FCBD3D970C926C10").unwrap();

let mut buf = Vec::new();

let serialize_g1 =
|cursor: &mut usize, buf: &mut Vec<u8>, zkp: &[u8]| -> Result<(), SerializationError> {
let proof = G1Affine::new_unchecked(
Fq::from(BigUint::from_bytes_be(&zkp[*cursor..*cursor + G1_SIZE])),
Fq::from(BigUint::from_bytes_be(
&zkp[*cursor + G1_SIZE..*cursor + (G1_SIZE * 2)],
)),
);
proof.check()?;
*cursor += G1_SIZE * 2;
proof.serialize_compressed(buf)?;
Ok(())
};

let serialize_g2 =
|cursor: &mut usize, buf: &mut Vec<u8>, zkp: &[u8]| -> Result<(), SerializationError> {
let proof = G2Affine::new_unchecked(
Fq2::new(
Fq::from(BigUint::from_bytes_be(
&zkp[*cursor + G1_SIZE..*cursor + (2 * G1_SIZE)],
)),
Fq::from(BigUint::from_bytes_be(&zkp[*cursor..*cursor + G1_SIZE])),
),
Fq2::new(
Fq::from(BigUint::from_bytes_be(
&zkp[*cursor + (G1_SIZE * 3)..*cursor + (G1_SIZE * 4)],
)),
Fq::from(BigUint::from_bytes_be(
&zkp[*cursor + (G1_SIZE * 2)..*cursor + (G1_SIZE * 3)],
)),
),
);
proof.check()?;
*cursor += G1_SIZE * 4;
proof.serialize_compressed(buf)?;
Ok(())
};

let mut cursor = 0;
// zkp.proof.a
serialize_g1(&mut cursor, &mut buf, &zkp).unwrap();
// zkp.proof.b
serialize_g2(&mut cursor, &mut buf, &zkp).unwrap();
// zkp.proof.c
serialize_g1(&mut cursor, &mut buf, &zkp).unwrap();
// zkp.poc
serialize_g1(&mut cursor, &mut buf, &zkp).unwrap();
// zkp.pok
serialize_g1(&mut cursor, &mut buf, &zkp).unwrap();

buf.extend_from_slice(&zkp[cursor..]);

let zkp = hex::decode("0E6F419184390EE9847CFF1AD98F8E29492391C536E99A2C95CB487AD22B9571931F9A9B33292FAE5567E5C0779F69E6055D4E5B48B834D71216AFCAEC185BECB919D325035A2F041F1480340DFEDFF7E67AD132B310CE1DA03F51188128ADAC0F75E49A4F4F93CA3655C0CEE5C585C2F49A266B8387DC3EA8740CB45FAC3A40B5FE2F004945FF5B1F9D4A1F49550E1509D2D919E35D3EC36D75428E950760225EC2FF49ACA3009786E67BD688E34E1B882BAAFC5317964E4A30F59ABF45B429063F586AD31A8F65F8898AEBA35973A35615DA7E82A3C167FB887D7C18C3602AF22C9ABEEC865038B544F756413AD8C409957FF28C5AA6131C3D3717B585A813B7BDECE396DE5A7C2476F8234D1DA3590B7A56A15B6CC6E9CB7C6A75D34AD4C20593B0B833D06F36E8A6447CCADE4B912E2FAC63B130D50F7A5F1CD3E04DD1AD280FE3DED32DDF1564CA4CDFB7EBA18E0F06D9D009E28B46A0F7C5460B5A6107DCD429604B508AFA61D9414E0F6F1915CE5787D871E90284E5B8FD559672D644170650667730FCF55085CE7AE91E0F271F648779C431C07A67C8925421DCFD8BD74E4AD3672BA0A57ACF1521BB653C6E0D24888CF809A128D8F3462BAE99400A645E1313CA535A9505832A87AA52644BD8B0A919FB11E5D3CF7DFED1A1FD638D04DD7BC5FE436681859040B7B77F9FA7E446B06D24369A9DA1C361AB2F9089C32A1614F35D8C0CE6D366C840F0866339156F0FF4C0E208AC203CF336BBDE9B6B5BD21898C35527B354A4E8D4ED77A2AA4F69AC7CDF9C70E2C4B7B2B9AB1913D22F448F3DD5351A07EC7BA74F77C4F232D4BA428F916D6809E7AD607926A5FDD41150FC7ACB376D2836365B2B98DDC97D5AE980398A13B9A3E43323D985943C2A").unwrap();
let buf = reencode_evm_zkp_for_sui(&zkp).unwrap();
println!("{}", hex::encode(&buf));
}

#[test]
fn dump_sui() {
let file = hex::decode("8086e08eb1cf3993e5ad8c6f563a64ce098028a481001d214d95a59a84e43d65c9f9ad2e9550b0f39a1d2ad6cbd4adb9a7b33f040abc2ba9b994e8a4a966a0994db3f84e9bd20f4308bbb5a835434c0510e39ac4193c4bdc6817912c028f1c638fd014d1d004ba199f0acd264c35afa7f21871996cc1d5124a8fe77d29a6adf713245f2ae42479b7b9f6a9c6215209b106f7dc4670698106c314c33bd4934aa904e7c8f1508ed6ee85bca883130450f03e20875d334afcbbf76648f5316bd0298f96ad63c4325a5fb3a3543ead06227ab9eaf3aabb2b0b81aa55e44dba938dee4b62b3e41ed39d96cce81569a4df88bd07ff886ab56ce74ddb88d799436c97fe6500f7957ae64b8cfa67faff2a842e9199f93d15a168e681751d3ed262855775940818295a72b5173f91f2ff44298efaf5bb793726c0c016602d11c47c5e51f7bea4bb49e7d9f70e88c3f67acc48e739883b49a682745799f90f65aa43aa219e4015a812631ecb4eb6cea58c4728509ddc670037f8470af2a4e570259f60749015ae641d3fdb0548b540c6526fcd67298480cf39fcb68db69dfc10c406738d3ffc11719fc6484b75dbdbda32979f19cb00000006ab8b14673eeba5331569419a8eef64d916761c7253de08eb2d9f1d180a4c65a87b22f85f1a84cb4f7e7b1b7bc07b5d5f8992ea01643a1cf3644ca96162e5c057264074e1837d0ef421db295c0502aaca1f3c7368270c5ba7ecbba2b06992ea4ab762895b5c5ac4c2b88b2b2b385af1963d666729d18552e58545883a4b78cf136840165c9b396ec40a7d6e8009c10cad8a4361ed926829a0bccc16df614bc4810fb37661f9b946173f6b45f339066037fce2e681cddcb2811a1f5728f133dc68ad226b5b860b5ff2a91e83c34add8b8ef087f719a413ddecb41bab41536c9b6d37ff0fa3c5b7c466c21962389eb2b2558afcbf691d60d25be2742fea58c80763964e5d537d6452e8403cafd851ca0177b22a8dc58016bb3e9090e6c17e3b06f3000000010000000096b833b796e17d0ae02eb662ebf8a73f1da45b3354b8f6d0660d43628328fc8c6a481dac073b1490dee2baec14f1baa1177d2390d8dd7751c0ed8b0bedbb620fc8b8dfe63a5e38f0fffa56e68e0e5d0b43ecb6ee5537d8cbb3ae3c5ca5d265b5999c10fdf65613a5e0c066a17222d25a95e61db7daad037a686f073dbccca19a3391bd11b68b0fa1878aa82f5c7439ab115f2692c0af6bb1f2b65c9db48f081ca0e306cd867c8351abd3e7fa9317170ea10ec9583a7b97a5803e9e0ea09c2299").unwrap();
let file = hex::decode("925c9a8d94f2a53ae6422956126ce095028ab0c69550a605d0b8f7abc90934ecd8f1ddd39744d3b6350bea3aca93ccdf859e3566688df58ea0349fd77fe2766233c3258169e927c4f48de38a78c9422a2cac68c6550524d61ab0a3e89f7d8d8aa70d09b7918654f7f886e976766961f41f58ae1513134cf99900e359fc2282de3db96afb32f3515d6b402c201dc0eb380aed7853a9a15fc2089c4d4d6220d1a9dccb1e1af709b9e6c7f1901873d8a2325337299f96180bc986c4b6b73bc943eb97184ef7a1cb6b29d15e5737fe21c1e8144d3f0ff0a4b111129c0e3eafed72f751776c7ea7b7121e2ef3cfbb6f326fb50944859bfb11c966d225132c24e9377d0649936ae40d23b05dc1fb04e38e12ffd23e086fa25bcda2c67ee05cf9e3525883595a722323eb32ea5fed585dbc6a885bba860493a741195294a506807b4084beafdc2d11ad73329cfeb528a3780b288cce5bd32c4400e142de4733f0ea331fa659757ba4776efda5d37a7d6bea6c0d272603fea15ede8993f2881b18904bfc17bf8ba06b37ef971120e37adacd6f79e0007775b433005a15a911902d0944d71b44811bb6afde00d65f7201ad33a8d30000000680b8092ccbfaa14079ceb76cd058e50e22ea80a22ba034123060552adb88c38749b0c72132c9771f58b48fbda359575f85263273f2a2158b2336f1445797bad8a05eb61e302c6f819c0bbcd329b9db510668de6894e0ae8340aaa217ed597acab89c669d8e6678ba4c2469bb04704b6b915b76657c21e86a35e17f666a710c9b32f3be287767edf142dfd483f8ec1685a79f14ce6ef6698143e2d6552ef86f8d9a17e792a658a4a4208a50deeece0c14097bfdf1e792cbea5efcb419b81b3885907fef8e452c6f6e5224dc1325eca7abbca4811cc5bfcde6fb5bba5722877b40584616564b1dd538e03bbc0c0b5343fc908f777c2fcc59ed481a56585f47c48b7776e92ef90a710bc7d6eeba3d8a0d5f3c8885924a2b5407b45718ec62f67982000000010000000099a4735f5ea5db8464326c674848d1075d5296f0d157f41a32833193b005b296ab6b8d56d98595afd587191ce0764b2f1380449dc6ed55558a7693429188d2d1ac5fdba824e28875f5c871695a8bd938cdd70fbbb83e462382981db8957d7ed4b5f6e5c6cfb88961a37ab43cdff8cf7df4e2427aefb232dfb083ea8e1437913c033734112aebcdd4243d5d88f21d708c07e139f82e1ff4f444adfe71db4695d5e2caec38815aaa202bc67637b052a0b340aa20e675638906d21d8493e27ea23d").unwrap();

let mut cursor = 0;
let alpha_g1 = G1Affine::deserialize_compressed(&file[cursor..cursor + G1_SIZE]).unwrap();
Expand Down
27 changes: 14 additions & 13 deletions lib/sui-light-client-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@ repository = { workspace = true }
workspace = true

[dependencies]
alloy = { workspace = true, features = ["sol-types"], optional = true }
bcs = { workspace = true }
bincode = { workspace = true, features = ["alloc", "derive"], optional = true }
blake2 = "0.10.6"
cosmwasm-std = { workspace = true, features = ["cosmwasm_2_1"] }
roaring = "0.10.12"
serde = { workspace = true, optional = true, features = ["derive"] }
serde_repr = { version = "0.1.20", optional = true }
serde_with = { workspace = true, features = ["macros", "json"] }
thiserror = { workspace = true }
typenum = { workspace = true }
unionlabs = { workspace = true }
unionlabs-primitives = { workspace = true, features = ["base58"] }
alloy = { workspace = true, features = ["sol-types"], optional = true }
bcs = { workspace = true }
bincode = { workspace = true, features = ["alloc", "derive"], optional = true }
blake2 = "0.10.6"
cosmwasm-std = { workspace = true, features = ["cosmwasm_2_1"] }
frame-support-procedural = { workspace = true }
roaring = "0.10.12"
serde = { workspace = true, optional = true, features = ["derive"] }
serde_repr = { version = "0.1.20", optional = true }
serde_with = { workspace = true, features = ["macros", "json"] }
thiserror = { workspace = true }
typenum = { workspace = true }
unionlabs = { workspace = true }
unionlabs-primitives = { workspace = true, features = ["base58"] }

[dev-dependencies]
hex-literal = { workspace = true }
Expand Down
25 changes: 21 additions & 4 deletions lib/sui-light-client-types/src/checkpoint_summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use unionlabs_primitives::{
Bytes, FixedBytes,
};

use crate::{crypto::AuthorityPublicKeyBytes, digest::Digest, U64};
use crate::{crypto::AuthorityPublicKeyBytes, Digest, U64};

pub type CheckpointSequenceNumber = u64;
pub type CheckpointTimestamp = u64;
Expand Down Expand Up @@ -87,7 +87,22 @@ pub struct EndOfEpochData {
/// Commitments to epoch specific state (e.g. live object set)
///
/// This is not used, so we ignore it
pub epoch_commitments: Vec<()>,
pub epoch_commitments: Vec<CheckpointCommitment>,
}

#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Encode, bincode::Decode))]
pub enum CheckpointCommitment {
ECMHLiveObjectSetDigest(ECMHLiveObjectSetDigest),
// Other commitment types (e.g. merkle roots) go here.
}

#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Encode, bincode::Decode))]
pub struct ECMHLiveObjectSetDigest {
pub digest: Digest,
}

#[derive(Clone, Debug, PartialEq, Eq)]
Expand All @@ -105,10 +120,12 @@ impl CheckpointContents {

#[cfg(feature = "serde")]
pub fn digest(&self) -> Digest {
use crate::fixed_bytes::SuiFixedBytes;

let mut hasher = Blake2b::<typenum::U32>::new();
hasher.update("CheckpointContents::");
bcs::serialize_into(&mut hasher, self).unwrap();
Digest(FixedBytes::new(hasher.finalize().into()))
SuiFixedBytes(FixedBytes::new(hasher.finalize().into()))
}
}

Expand All @@ -128,7 +145,7 @@ pub struct CheckpointContentsV1 {
pub user_signatures: Vec<Vec<GenericSignature>>,
}

#[derive(Eq, PartialEq, Copy, Clone, Debug)]
#[derive(Eq, PartialEq, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Encode, bincode::Decode))]
pub struct ExecutionDigests {
Expand Down
5 changes: 3 additions & 2 deletions lib/sui-light-client-types/src/consensus_state.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::digest::Digest;
use crate::Digest;

#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
Expand All @@ -12,6 +12,7 @@ pub mod ethabi {
use unionlabs::impl_ethabi_via_try_from_into;

use super::*;
use crate::fixed_bytes::SuiFixedBytes;

impl_ethabi_via_try_from_into!(ConsensusState => SolConsensusState);

Expand Down Expand Up @@ -40,7 +41,7 @@ pub mod ethabi {
fn try_from(value: SolConsensusState) -> Result<Self, Self::Error> {
Ok(Self {
timestamp: value.timestamp,
content_digest: Digest(value.content_digest.into()),
content_digest: SuiFixedBytes(value.content_digest.into()),
})
}
}
Expand Down
Loading