Skip to content
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 go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ require (
github.com/spf13/cobra v1.9.1
github.com/stretchr/testify v1.10.0
github.com/testcontainers/testcontainers-go v0.37.0
github.com/trufnetwork/kwil-db v0.10.3-0.20260108163022-4af0579f0ecf
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260108163022-4af0579f0ecf
github.com/trufnetwork/kwil-db v0.10.3-0.20260109051031-0955c8d87ef6
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260109051031-0955c8d87ef6
github.com/trufnetwork/sdk-go v0.3.2-0.20250630062504-841b40cdb709
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa
Expand Down
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,12 @@ github.com/trufnetwork/kwil-db v0.10.3-0.20260108143501-5a4b71722836 h1:imLAq+R1
github.com/trufnetwork/kwil-db v0.10.3-0.20260108143501-5a4b71722836/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo=
github.com/trufnetwork/kwil-db v0.10.3-0.20260108163022-4af0579f0ecf h1:m0mJy0kSyUn/POcTonSBmqVuhak5l8rRqBmJvP/7+Y8=
github.com/trufnetwork/kwil-db v0.10.3-0.20260108163022-4af0579f0ecf/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo=
github.com/trufnetwork/kwil-db v0.10.3-0.20260109033107-1229f5f7af8c h1:6FTG3G0Eki4xvLNtZ3L6u4nut8qwOMLM/6au7fjuBdk=
github.com/trufnetwork/kwil-db v0.10.3-0.20260109033107-1229f5f7af8c/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo=
github.com/trufnetwork/kwil-db v0.10.3-0.20260109045323-5526d81c5ac1 h1:+A3uD4W++XxCt3sRuF0icVZhPLz8bipinpFL5rBYZ0c=
github.com/trufnetwork/kwil-db v0.10.3-0.20260109045323-5526d81c5ac1/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo=
github.com/trufnetwork/kwil-db v0.10.3-0.20260109051031-0955c8d87ef6 h1:BNp/U5QongrNhxc+wfcnmX+F0rLZKh3liKA8/cKWpjQ=
github.com/trufnetwork/kwil-db v0.10.3-0.20260109051031-0955c8d87ef6/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo=
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107154136-b8af58932e24 h1:5RcJ0Cyt9UaXwv71d9jYgwGL2zwyTJdP9m4wkk6B6Z8=
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107154136-b8af58932e24/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ=
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260108132315-b1fcfb33a848 h1:/0naLqfmAqfL5XWdN1yulk5auImOP14Taw0B1baq3GU=
Expand All @@ -1228,6 +1234,12 @@ github.com/trufnetwork/kwil-db/core v0.4.3-0.20260108143501-5a4b71722836 h1:GbT+
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260108143501-5a4b71722836/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ=
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260108163022-4af0579f0ecf h1:ysL3QbwQtONB4vS2iQ8YsxpdrrDa8ivpneRTWBi4daM=
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260108163022-4af0579f0ecf/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ=
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260109033107-1229f5f7af8c h1:mTZhP+rSfmlCH6Cb6dCONbT+44g0Ek8tWTvD3wtkA9k=
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260109033107-1229f5f7af8c/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ=
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260109045323-5526d81c5ac1 h1:KsZIAXNTnbukp6p89y2I9bCjGBFvJXFU6u66y91dYkk=
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260109045323-5526d81c5ac1/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ=
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260109051031-0955c8d87ef6 h1:SF9daN+N00xe5MYAgENF8dj+9bsaVZO2BhN2CQVHH5Q=
github.com/trufnetwork/kwil-db/core v0.4.3-0.20260109051031-0955c8d87ef6/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ=
github.com/trufnetwork/openzeppelin-merkle-tree-go v0.0.2 h1:DCq8MzbWH0wZmICNmMVsSzUHUPl+2vqRhluEABjxl88=
github.com/trufnetwork/openzeppelin-merkle-tree-go v0.0.2/go.mod h1:Y0MJpPp9QXU5vC6Gpoilql2NkgmGNcbHm9HYC2v2N8s=
github.com/trufnetwork/sdk-go v0.3.2-0.20250630062504-841b40cdb709 h1:d9EqPXIjbq/atzEncK5dM3Z9oStx1BxCGuL/sjefeCw=
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-- Withdrawal Proof Action for Hoodi Non-Custodial Bridge
-- This action exposes the list_wallet_rewards precompile as a public action.
-- Returns merkle proofs AND validator signatures - everything needed for withdrawal.
-- Returns ALL confirmed epochs, not just first one (uses RETURN NEXT)
-- Epochs filtered by withdrawals table (only unclaimed epochs returned)
Comment thread
MicBun marked this conversation as resolved.
CREATE OR REPLACE ACTION hoodi_get_withdrawal_proof($wallet_address TEXT)
PUBLIC VIEW RETURNS TABLE (
chain TEXT,
Expand All @@ -15,8 +17,10 @@ PUBLIC VIEW RETURNS TABLE (
signatures BYTEA[]
) {
-- with_pending = false means only return confirmed epochs (ready for withdrawal)
-- Returns ALL confirmed epochs ordered by height DESC (newest first)
FOR $row IN hoodi_bridge.list_wallet_rewards($wallet_address, false) {
RETURN $row.chain, $row.chain_id, $row.contract, $row.created_at,
-- Return each row (don't exit loop!)
RETURN NEXT $row.chain, $row.chain_id, $row.contract, $row.created_at,
$row.param_recipient, $row.param_amount, $row.param_block_hash,
$row.param_root, $row.param_proofs, $row.param_signatures;
}
Expand Down
16 changes: 16 additions & 0 deletions tests/extensions/erc20/erc20_bridge_withdrawal_proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ func TestHoodiGetWithdrawalProofAction(t *testing.T) {
)
require.NoError(t, err, "failed to finalize epoch")

// Add validator signature for the epoch (required for withdrawal proofs)
err = erc20shim.ForTestingAddValidatorSignatureToEpoch(
ctx, platform,
MigrationHoodiChain,
MigrationHoodiEscrow,
)
require.NoError(t, err, "failed to add validator signature")

// Call the PUBLIC ACTION hoodi_get_withdrawal_proof
// This is the action users will call in production
engineCtx = engCtx(ctx, platform, "0x0000000000000000000000000000000000000000", 3, false)
Expand Down Expand Up @@ -384,6 +392,14 @@ func TestHoodiGetWithdrawalProofMultipleUsers(t *testing.T) {
)
require.NoError(t, err)

// Add validator signature for the epoch
err = erc20shim.ForTestingAddValidatorSignatureToEpoch(
ctx, platform,
MigrationHoodiChain,
MigrationHoodiEscrow,
)
require.NoError(t, err)

// Call public action for User A
engineCtx = engCtx(ctx, platform, "0x0000000000000000000000000000000000000000", 4, false)
var proofRowsA int
Expand Down
Loading