diff --git a/go.mod b/go.mod index 815c4f58a..aba33ca19 100644 --- a/go.mod +++ b/go.mod @@ -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.20260107143801-603894fe5efa - github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107143801-603894fe5efa + 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/sdk-go v0.3.2-0.20250630062504-841b40cdb709 go.uber.org/zap v1.27.0 golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa diff --git a/go.sum b/go.sum index 6a958b74d..6b8f9d1b1 100644 --- a/go.sum +++ b/go.sum @@ -1212,126 +1212,22 @@ github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZ github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY= github.com/tklauser/numcpus v0.9.0 h1:lmyCHtANi8aRUgkckBgoDk1nHCux3n2cgkJLXdQGPDo= github.com/tklauser/numcpus v0.9.0/go.mod h1:SN6Nq1O3VychhC1npsWostA+oW+VOQTxZrS604NSRyI= -github.com/trufnetwork/kwil-db v0.10.3-0.20260101105526-d342631a3450 h1:YW824z7QSsEZ1a3ptzAar7F0IUcPlpuxtZ1lyhNmtgs= -github.com/trufnetwork/kwil-db v0.10.3-0.20260101105526-d342631a3450/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260101162317-3138ef2cfd20 h1:x7YATEFiipoIFsuTaKZUYXF16Q7p9RKuuhwqbwxyJjc= -github.com/trufnetwork/kwil-db v0.10.3-0.20260101162317-3138ef2cfd20/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260101165725-5ad8ece06f65 h1:/wIYlxDhNkkzqI18fluQhR2DnNBBDUDWFPF8rpKs4Ek= -github.com/trufnetwork/kwil-db v0.10.3-0.20260101165725-5ad8ece06f65/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105044324-9e2c67eb619b h1:URjS8qgweTAyxcnTf5l38eUYp98n7J6ZjwEq8bqJ7Eo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105044324-9e2c67eb619b/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105064543-5018dee55c90 h1:PAP1SyVpe8X5UU65G0osHWyxfBbUDr2Hn5CVA+TBsyY= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105064543-5018dee55c90/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105065417-4c4bb13d50aa h1:CF35IeNDHCSw9PpyIMZ2HHwfv+HiucNl3brc2TeRKsw= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105065417-4c4bb13d50aa/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105080833-18feba66ec10 h1:SPTUR1s9EKxJDTzyB3HJ+MYvCJh72A6cyeDgdu1xsSY= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105080833-18feba66ec10/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105081705-85a556f1fd4d h1:uHvk7Y1EwR00Wp6OYpHgoDaITvAU6hHUZAEL49+fCRA= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105081705-85a556f1fd4d/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105083553-5fa18c50e6b5 h1:iEceZDeXLEw2h8rBkzyVImPaOW9d45X0CILWai3z5xI= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105083553-5fa18c50e6b5/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105091716-3c220f424df2 h1:y/uPvPawi9ks3cpNH+L98C1ykcWqqneIkDh8HKf6KvQ= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105091716-3c220f424df2/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105092758-a8c6495905e2 h1:Sow6m0Ur6xda/X+Hmc12Ke8vm7vB3lyCHbQrYQJIkFI= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105092758-a8c6495905e2/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105101416-f057eecbfce9 h1:TEABJzUMHPjgKPpf/WCZv1gkIhdYGxgc0tZpOPhbX6Y= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105101416-f057eecbfce9/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105101844-1564eeff2484 h1:SHXQVBTDaXbWhsLnHQ4ym3yi0NNNt3061MCpfm6l1Qw= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105101844-1564eeff2484/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105105219-e08faa3aa786 h1:kkEnNNHqk6SJtTGGDJDYehvZck/JjwabCJ7fQojE13A= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105105219-e08faa3aa786/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105140150-8cf64c7c423e h1:iWWW3u0D33dDubk1juIwTFegJRiM+WdfOQvrdDEHxMQ= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105140150-8cf64c7c423e/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105145004-146346e9b17a h1:AUgki7kI51Nvk3RDgOgfGzx1QRMILEUx3nT6mAsNjHw= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105145004-146346e9b17a/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105160236-48d938ffcbb3 h1:1G6qrFUvLrkEKO1OS2ceBh/F2KHhVcp5DKlFEv/CiGo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260105160236-48d938ffcbb3/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260106064329-954e6da66797 h1:x5A1Jon3aH9BuCfFri35uDLMrGccloyyfSRQyRZLu3k= -github.com/trufnetwork/kwil-db v0.10.3-0.20260106064329-954e6da66797/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260106110057-81fff81a486f h1:54oMD8N5YF0t1YIFtjIRGal6v0/FLRRTw7gCqnsw65c= -github.com/trufnetwork/kwil-db v0.10.3-0.20260106110057-81fff81a486f/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260106121031-d63ee139aac3 h1:f5Dp1w6eRPPQlm4wG7GDl+X1X+8XXALJbVNi+cwNOVI= -github.com/trufnetwork/kwil-db v0.10.3-0.20260106121031-d63ee139aac3/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260106133543-a7a9921bc5e3 h1:5dp2GDmhGge9HHP0banDvoNQCJ9ODFD4UV/hU21zAdE= -github.com/trufnetwork/kwil-db v0.10.3-0.20260106133543-a7a9921bc5e3/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260106140132-2d71609cf5ad h1:NmTyDTQCNcBu7QT2CiFtCfec3lu21x8T10zmNDzpagM= -github.com/trufnetwork/kwil-db v0.10.3-0.20260106140132-2d71609cf5ad/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260106171154-7f8b5350c13d h1:N3QGbtb1p+NvgnCJu6Id6IrPp3gP9RRSrZL49vu1DlA= -github.com/trufnetwork/kwil-db v0.10.3-0.20260106171154-7f8b5350c13d/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107035123-20a562fc2641 h1:sBxfHmU/oCDEn8d2mKdo2tBEjjWIS/2jbaH/3mBA2sk= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107035123-20a562fc2641/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107112240-517b8e60b0a8 h1:S7ayTFO4PHtlqO7HHsItu/ysxYwxz/CsMrFO+fGiWeQ= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107112240-517b8e60b0a8/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107114436-41b236325294 h1:T4hYSrGMHrEVjqKLP1BwO+z8JZs0EzBRor9Gxnxi59g= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107114436-41b236325294/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107120950-62facc089acb h1:cJNXuqZBRe/oigbHc0wvplk+gdTShpyehK6iSI2sPZI= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107120950-62facc089acb/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107123619-63b8f33a19a4 h1:r8YiNZ7XThMCM0Bu3JHDTkCPzi0Jwgl6hdzBTvDDuuY= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107123619-63b8f33a19a4/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107140215-8aa3338d1736 h1:dlxvA5bsaKAPWgnv7K6mwz8V9rk5ijV/ccpf/N/6NOQ= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107140215-8aa3338d1736/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107143801-603894fe5efa h1:Yqdo6liRA7rK45K5j0YtZLM2xj43RpM1YeC11LfpuPs= -github.com/trufnetwork/kwil-db v0.10.3-0.20260107143801-603894fe5efa/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260101105526-d342631a3450 h1:2sBPX0HHzymX4xrCJhHKvTbQ51hdiBoqI9yn9vWgOSs= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260101105526-d342631a3450/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260101162317-3138ef2cfd20 h1:9Gfq4UY/eXxs4SRdWY3t+kbJApEHDqCI6zXoNvSPu20= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260101162317-3138ef2cfd20/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260101165725-5ad8ece06f65 h1:HeO02mkLmweBcQt6p3mg0p75J0Dq/B9FUoaa5Zw3HQA= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260101165725-5ad8ece06f65/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105044324-9e2c67eb619b h1:i3MZfORRXzBV/9rfI5pAzZQ8Mu3OqU6O5RdrxRu6L4s= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105044324-9e2c67eb619b/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105064543-5018dee55c90 h1:EWW0wdX0GMye5HvF7JHDiSEJUOFWv3tks7dnHAV0Irs= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105064543-5018dee55c90/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105065417-4c4bb13d50aa h1:9Qe72XAouGIcBxd8+MWLzf2AUGjA2Ax0OgbQRDcmZXk= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105065417-4c4bb13d50aa/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105080833-18feba66ec10 h1:4DcNwAUXZiMcFOCD8orUmnlef46abfvih5qkUN3TNx8= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105080833-18feba66ec10/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105081705-85a556f1fd4d h1:D9mD8CmrmT980bJupYEVqu2KIB/tuUKPqcV9y1g6dm4= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105081705-85a556f1fd4d/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105083553-5fa18c50e6b5 h1:pKXGoAKEi1MuLCgUmGxH20Sl8V8nb6yYMTGj+dz7uhw= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105083553-5fa18c50e6b5/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105091716-3c220f424df2 h1:6vgKKPzCH7AnfPYuPDJuki5f5lS/XuRNhMH7gmZigqU= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105091716-3c220f424df2/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105092758-a8c6495905e2 h1:BOE6bOFUhFKXZDeD7rf/RelbkANyvy8IVMaJOmEa9yQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105092758-a8c6495905e2/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105101416-f057eecbfce9 h1:xMG8rHllXdwF1AifHMFCoBmubltDhSntIwSfkr6P1Wg= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105101416-f057eecbfce9/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105101844-1564eeff2484 h1:hZVxF+KOD5PIxebXp+NdnTMd5S2m911Ow6Vk4umCaBI= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105101844-1564eeff2484/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105105219-e08faa3aa786 h1:N4ZuWwBJ4s0kFQvjHA98qSKvNYjALrrUm0smah5dmXw= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105105219-e08faa3aa786/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105140150-8cf64c7c423e h1:P1TfrX/8VWALHBN7q5SwtR83l5W+5kXlqZ7UjLjs5TA= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105140150-8cf64c7c423e/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105145004-146346e9b17a h1:Ro6pWeEUxm61PYS4GU0vRFceuWLcoFkCM/0d1DynaiE= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105145004-146346e9b17a/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105160236-48d938ffcbb3 h1:i36nS646yNFDVP62EjvVAd2UQyZXJyFCmt7txwh7sDc= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260105160236-48d938ffcbb3/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260106064329-954e6da66797 h1:k4rHmZYQSJ81ixHx6ZtABWViK2QkkPZCvvUws1FhefU= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260106064329-954e6da66797/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260106110057-81fff81a486f h1:ScZKKte6wEq1q3PtDIGG5na9k/BCLOzaD+0H53QXAes= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260106110057-81fff81a486f/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260106121031-d63ee139aac3 h1:siwsqWIcYqmixLUDCWQqhucN96FkSYcDnmtZ7dZxoAA= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260106121031-d63ee139aac3/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260106133543-a7a9921bc5e3 h1:ANgUKC9GBVNKGRX5AHyliIH/jsY23oHI8OOQ5raGaHw= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260106133543-a7a9921bc5e3/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260106140132-2d71609cf5ad h1:6XNSQX77Jac0p7vV+MW3NqyNVElqsWOmUj8RrlUAHCo= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260106140132-2d71609cf5ad/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260106171154-7f8b5350c13d h1:dmPpHjB9jwpsLUp3MMkAcC6xoiOmjZiz2u2exCsu/30= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260106171154-7f8b5350c13d/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107035123-20a562fc2641 h1:4MO3IPtRWUsZ/xUENzzVvb7iL+eLaKCqumIiNZISNA0= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107035123-20a562fc2641/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107112240-517b8e60b0a8 h1:ANnOaYFMokBWqGP3brKEs1JcmNxA9q+JG1bLejyvYDE= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107112240-517b8e60b0a8/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107114436-41b236325294 h1:GyuvXvONcf/MgSDt2VsAuNpSir3p8Bl9c/5aCQdOwdU= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107114436-41b236325294/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107120950-62facc089acb h1:59oFRGdQSZ9nFYfhcnBj/pUjO52oCLQkShqQDOa3PYs= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107120950-62facc089acb/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107123619-63b8f33a19a4 h1:VQoiSUqETrnb9H2eQeTLBo7PqhTXN5G+uIyeqjOvEDA= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107123619-63b8f33a19a4/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107140215-8aa3338d1736 h1:wicawNNR2anP7dQbiLEm0XAT9Csr6Wg9BqumCq/s5gM= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107140215-8aa3338d1736/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107143801-603894fe5efa h1:7BZ/WedE5AVTceiwEIjRoY4pHKzL0YsUGzT/bSrkO5Y= -github.com/trufnetwork/kwil-db/core v0.4.3-0.20260107143801-603894fe5efa/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= +github.com/trufnetwork/kwil-db v0.10.3-0.20260107154136-b8af58932e24 h1:bZGhXU4N2tZbwmZGWRWybVZoYvjybWDytlDXgYaPYt0= +github.com/trufnetwork/kwil-db v0.10.3-0.20260107154136-b8af58932e24/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= +github.com/trufnetwork/kwil-db v0.10.3-0.20260108132315-b1fcfb33a848 h1:if1b7eUDwYuUnqefO76MDeX/8mwkOPo+QPPZR806VAA= +github.com/trufnetwork/kwil-db v0.10.3-0.20260108132315-b1fcfb33a848/go.mod h1:LiBAC48uZl2B0IiLtD2hpOce7RNfpuDdghVAOc3u1Qo= +github.com/trufnetwork/kwil-db v0.10.3-0.20260108143501-5a4b71722836 h1:imLAq+R1o8kIK++IxgEaOUEcgNWcSnFaJz3axHtX8aI= +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/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= +github.com/trufnetwork/kwil-db/core v0.4.3-0.20260108132315-b1fcfb33a848/go.mod h1:HnOsh9+BN13LJCjiH0+XKaJzyjWKf+H9AofFFp90KwQ= +github.com/trufnetwork/kwil-db/core v0.4.3-0.20260108143501-5a4b71722836 h1:GbT+bcD4LovTEpZPqCW49lKcaotB8Ytl5xs5wQT8UrI= +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/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= diff --git a/internal/migrations/erc20-bridge/004-withdrawal-proof-action.sql b/internal/migrations/erc20-bridge/004-withdrawal-proof-action.sql new file mode 100644 index 000000000..925d0533d --- /dev/null +++ b/internal/migrations/erc20-bridge/004-withdrawal-proof-action.sql @@ -0,0 +1,23 @@ +-- 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. +CREATE OR REPLACE ACTION hoodi_get_withdrawal_proof($wallet_address TEXT) +PUBLIC VIEW RETURNS TABLE ( + chain TEXT, + chain_id TEXT, + contract TEXT, + created_at INT8, + recipient TEXT, + amount NUMERIC(78, 0), + block_hash BYTEA, + root BYTEA, + proofs BYTEA[], + signatures BYTEA[] +) { + -- with_pending = false means only return confirmed epochs (ready for withdrawal) + FOR $row IN hoodi_bridge.list_wallet_rewards($wallet_address, false) { + RETURN $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; + } +}; diff --git a/tests/extensions/erc20/erc20_bridge_withdrawal_proof_test.go b/tests/extensions/erc20/erc20_bridge_withdrawal_proof_test.go new file mode 100644 index 000000000..0efc00795 --- /dev/null +++ b/tests/extensions/erc20/erc20_bridge_withdrawal_proof_test.go @@ -0,0 +1,432 @@ +//go:build kwiltest + +package tests + +import ( + "context" + "encoding/hex" + "strings" + "testing" + + "github.com/stretchr/testify/require" + "github.com/trufnetwork/kwil-db/common" + "github.com/trufnetwork/kwil-db/core/types" + erc20shim "github.com/trufnetwork/kwil-db/node/exts/erc20-bridge/erc20" + kwilTesting "github.com/trufnetwork/kwil-db/testing" + testerc20 "github.com/trufnetwork/node/tests/streams/utils/erc20" +) + +// Hoodi constants for migration-registered instance +const ( + // Real Hoodi chain and addresses (from migrations) + MigrationHoodiChain = "hoodi" + MigrationHoodiEscrow = "0x878d6aaeb6e746033f50b8dc268d54b4631554e7" + MigrationHoodiAlias = "hoodi_bridge" // Alias from migration 000-extension.sql +) + +// TestHoodiGetWithdrawalProofAction tests the public hoodi_get_withdrawal_proof action. +// This test uses the migration-registered hoodi_bridge instance (not a test-specific instance). +// +// Test flow: +// 1) Seed data into migration-registered hoodi_bridge instance +// 2) User deposits and withdraws +// 3) Finalize and confirm epoch +// 4) Call public action hoodi_get_withdrawal_proof +// 5) Verify returned merkle proof structure +// +// This validates the full end-to-end public API that users will call. +func TestHoodiGetWithdrawalProofAction(t *testing.T) { + seedAndRun(t, "hoodi_get_withdrawal_proof_action", func(ctx context.Context, platform *kwilTesting.Platform) error { + // The hoodi_bridge instance is already created by migrations (000-extension.sql) + // We just need to seed it with test data + + testUser := "0xf9820f9143699cac6f662b19a4b29e13c9393783" + testAmount := "100000000000000000000" // 100 tokens + + // The hoodi_bridge instance already exists from migrations + // Need to sync it to database AND load into singleton + _, err := erc20shim.ForTestingForceSyncInstance( + ctx, platform, + MigrationHoodiChain, + MigrationHoodiEscrow, + "0x0000000000000000000000000000000000000001", // Fake ERC20 for testing + 18, + ) + require.NoError(t, err, "failed to sync hoodi_bridge instance") + + // Load DB instances into singleton + err = erc20shim.ForTestingInitializeExtension(ctx, platform) + require.NoError(t, err, "failed to initialize ERC20 extension") + + // Inject deposit to give user balance + err = testerc20.InjectERC20Transfer( + ctx, platform, + MigrationHoodiChain, + MigrationHoodiEscrow, + "0x0000000000000000000000000000000000000001", // Fake ERC20 + testUser, + testUser, + testAmount, + 10, + nil, + ) + require.NoError(t, err, "failed to inject deposit") + + // User requests withdrawal via bridge action + engineCtx := engCtx(ctx, platform, testUser, 2, false) + amtDec, err := types.ParseDecimalExplicit(testAmount, 78, 0) + require.NoError(t, err) + + // Call bridge() on the migration-registered instance + r, err := platform.Engine.Call(engineCtx, platform.DB, MigrationHoodiAlias, "bridge", + []any{testUser, amtDec}, + func(row *common.Row) error { return nil }) + require.NoError(t, err) + if r != nil && r.Error != nil { + return r.Error + } + + // Finalize and confirm epoch + var bh [32]byte + copy(bh[:], []byte("test_block_hash_0000000000000000")) + err = erc20shim.ForTestingFinalizeAndConfirmCurrentEpoch( + ctx, platform, + MigrationHoodiChain, + MigrationHoodiEscrow, + 11, + bh, + ) + require.NoError(t, err, "failed to finalize epoch") + + // Call the PUBLIC ACTION hoodi_get_withdrawal_proof + // This is the action users will call in production + engineCtx = engCtx(ctx, platform, "0x0000000000000000000000000000000000000000", 3, false) + + var proofRows int + var chain, chainID, contract, recipient string + var amount *types.Decimal + var blockHash, root []byte + var proofs [][]byte + var signatures [][]byte + + r, err = platform.Engine.Call(engineCtx, platform.DB, "", "hoodi_get_withdrawal_proof", + []any{testUser}, // Just wallet address parameter + func(row *common.Row) error { + proofRows++ + + // Verify all 10 columns are present (including signatures) + require.Equal(t, 10, len(row.Values), "should return 10 columns including signatures") + + // Extract values + chain = row.Values[0].(string) + chainID = row.Values[1].(string) + contract = row.Values[2].(string) + // created_at is row.Values[3] (int64) + recipient = row.Values[4].(string) + amount = row.Values[5].(*types.Decimal) + blockHash = row.Values[6].([]byte) + root = row.Values[7].([]byte) + + // Extract proofs (BYTEA[] type) + var ok bool + proofs, ok = row.Values[8].([][]byte) + if !ok { + // Fallback to []any + proofsRaw, ok2 := row.Values[8].([]any) + require.True(t, ok2, "proofs should be array (got type %T)", row.Values[8]) + proofs = make([][]byte, len(proofsRaw)) + for i, p := range proofsRaw { + pb, ok3 := p.([]byte) + require.True(t, ok3, "proof element %d should be []byte (got type %T)", i, p) + proofs[i] = pb + } + } + + // Extract signatures (BYTEA[] type) - NEW! + signatures, ok = row.Values[9].([][]byte) + if !ok { + // Fallback to []any + signaturesRaw, ok2 := row.Values[9].([]any) + require.True(t, ok2, "signatures should be array (got type %T)", row.Values[9]) + signatures = make([][]byte, len(signaturesRaw)) + for i, s := range signaturesRaw { + sb, ok3 := s.([]byte) + require.True(t, ok3, "signature element %d should be []byte (got type %T)", i, s) + signatures[i] = sb + } + } + + return nil + }) + require.NoError(t, err, "action call failed") + if r != nil && r.Error != nil { + t.Logf("Action error: %v", r.Error) + return r.Error + } + + // Verify we got exactly one proof + require.Equal(t, 1, proofRows, "should return exactly one withdrawal proof") + + // Log what we got + t.Logf("Returned data: chain=%s, chainID=%s, contract=%s, recipient=%s", chain, chainID, contract, recipient) + t.Logf("Amount: %s", amount.String()) + t.Logf("BlockHash length: %d, Root length: %d, Proofs length: %d, Signatures length: %d", len(blockHash), len(root), len(proofs), len(signatures)) + + // Verify returned data structure + require.Equal(t, MigrationHoodiChain, chain, "chain should match") + require.NotEmpty(t, chainID, "chain_id should not be empty") + require.True(t, strings.EqualFold(MigrationHoodiEscrow, contract), "contract should match escrow") + require.True(t, strings.EqualFold(testUser, recipient), "recipient should match user") + require.Equal(t, testAmount, amount.String(), "amount should match withdrawal") + require.NotEmpty(t, blockHash, "block_hash should not be empty") + require.NotEmpty(t, root, "merkle root should not be empty") + + // Merkle proofs may be empty for single-element tree (no siblings needed) + // This is actually correct! A tree with one element has no proof elements. + t.Logf("Merkle proof elements: %d (expected 0 for single reward)", len(proofs)) + + // Verify block hash matches + require.Equal(t, bh[:], blockHash, "block hash should match finalized epoch") + + // Verify merkle proof structure + require.Equal(t, 32, len(root), "merkle root should be 32 bytes") + + // Note: proofs array may be empty for single-element merkle tree + // This is correct! No siblings = no proof elements needed + for i, proof := range proofs { + require.Equal(t, 32, len(proof), "proof element %d should be 32 bytes", i) + t.Logf("Proof %d: 0x%s", i, hex.EncodeToString(proof)) + } + t.Logf("Merkle root: 0x%s", hex.EncodeToString(root)) + t.Logf("Total proof elements: %d", len(proofs)) + + // Verify validator signatures structure (NEW!) + require.NotEmpty(t, signatures, "should have at least one validator signature") + for i, sig := range signatures { + require.Equal(t, 65, len(sig), "signature %d should be 65 bytes (r||s||v)", i) + t.Logf("Signature %d length: %d bytes", i, len(sig)) + } + t.Logf("Total validator signatures: %d", len(signatures)) + + t.Logf("✅ Public action hoodi_get_withdrawal_proof works correctly") + t.Logf(" Chain: %s", chain) + t.Logf(" ChainID: %s", chainID) + t.Logf(" Contract: %s", contract) + t.Logf(" Recipient: %s", recipient) + t.Logf(" Amount: %s wei", amount.String()) + t.Logf(" Validator Signatures: %d", len(signatures)) + + return nil + }) +} + +// TestHoodiGetWithdrawalProofNoPending tests that pending epochs are not returned. +func TestHoodiGetWithdrawalProofNoPending(t *testing.T) { + seedAndRun(t, "hoodi_get_withdrawal_proof_no_pending", func(ctx context.Context, platform *kwilTesting.Platform) error { + testUser := "0xabc0000000000000000000000000000000000001" + testAmount := "50000000000000000000" + + // Sync the migration-created instance + _, err := erc20shim.ForTestingForceSyncInstance( + ctx, platform, + MigrationHoodiChain, + MigrationHoodiEscrow, + "0x0000000000000000000000000000000000000001", + 18, + ) + require.NoError(t, err) + + // Load DB instances into singleton + err = erc20shim.ForTestingInitializeExtension(ctx, platform) + require.NoError(t, err) + + // Give user balance + err = testerc20.InjectERC20Transfer( + ctx, platform, + MigrationHoodiChain, + MigrationHoodiEscrow, + "0x0000000000000000000000000000000000000001", + testUser, + testUser, + testAmount, + 10, + nil, + ) + require.NoError(t, err) + + // User withdraws + engineCtx := engCtx(ctx, platform, testUser, 2, false) + amtDec, err := types.ParseDecimalExplicit(testAmount, 78, 0) + require.NoError(t, err) + + r, err := platform.Engine.Call(engineCtx, platform.DB, MigrationHoodiAlias, "bridge", + []any{testUser, amtDec}, + func(row *common.Row) error { return nil }) + require.NoError(t, err) + if r != nil && r.Error != nil { + return r.Error + } + + // DO NOT finalize epoch - leave it pending + + // Call public action + engineCtx = engCtx(ctx, platform, "0x0000000000000000000000000000000000000000", 3, false) + var proofRows int + r, err = platform.Engine.Call(engineCtx, platform.DB, "", "hoodi_get_withdrawal_proof", + []any{testUser}, + func(row *common.Row) error { + proofRows++ + return nil + }) + require.NoError(t, err) + if r != nil && r.Error != nil { + return r.Error + } + + // Should return 0 rows (pending epoch not included) + require.Equal(t, 0, proofRows, "should return no proofs for pending epochs") + + t.Logf("✅ Pending epochs correctly excluded from withdrawal proofs") + + return nil + }) +} + +// TestHoodiGetWithdrawalProofMultipleUsers tests multiple users with withdrawals in one epoch. +// Note: Testing multiple EPOCHS requires complex timing logic not yet in test infrastructure. +// This test validates that multiple users can each retrieve their withdrawal proofs correctly. +func TestHoodiGetWithdrawalProofMultipleUsers(t *testing.T) { + seedAndRun(t, "hoodi_get_withdrawal_proof_multiple_users", func(ctx context.Context, platform *kwilTesting.Platform) error { + userA := "0xabc0000000000000000000000000000000000001" + userB := "0xabc0000000000000000000000000000000000002" + amount100 := "100000000000000000000" + amount50 := "50000000000000000000" + amount25 := "25000000000000000000" + + // Sync the migration-created instance + _, err := erc20shim.ForTestingForceSyncInstance( + ctx, platform, + MigrationHoodiChain, + MigrationHoodiEscrow, + "0x0000000000000000000000000000000000000001", + 18, + ) + require.NoError(t, err) + + // Load DB instances into singleton + err = erc20shim.ForTestingInitializeExtension(ctx, platform) + require.NoError(t, err) + + // Give User A 100 tokens + err = testerc20.InjectERC20Transfer( + ctx, platform, + MigrationHoodiChain, + MigrationHoodiEscrow, + "0x0000000000000000000000000000000000000001", + userA, + userA, + amount100, + 10, + nil, + ) + require.NoError(t, err) + + // Give User B 50 tokens (chained) + prevPoint := int64(10) + err = testerc20.InjectERC20Transfer( + ctx, platform, + MigrationHoodiChain, + MigrationHoodiEscrow, + "0x0000000000000000000000000000000000000001", + userB, + userB, + amount50, + 11, + &prevPoint, + ) + require.NoError(t, err) + + // User A withdraws 50 tokens + engineCtx := engCtx(ctx, platform, userA, 2, false) + amt50Dec, err := types.ParseDecimalExplicit(amount50, 78, 0) + require.NoError(t, err) + + r, err := platform.Engine.Call(engineCtx, platform.DB, MigrationHoodiAlias, "bridge", + []any{userA, amt50Dec}, + func(row *common.Row) error { return nil }) + require.NoError(t, err) + if r != nil && r.Error != nil { + return r.Error + } + + // User B withdraws 25 tokens + engineCtx = engCtx(ctx, platform, userB, 3, false) + amt25Dec, err := types.ParseDecimalExplicit(amount25, 78, 0) + require.NoError(t, err) + + r, err = platform.Engine.Call(engineCtx, platform.DB, MigrationHoodiAlias, "bridge", + []any{userB, amt25Dec}, + func(row *common.Row) error { return nil }) + require.NoError(t, err) + if r != nil && r.Error != nil { + return r.Error + } + + // Finalize epoch with both withdrawals + var bh [32]byte + copy(bh[:], []byte("test_block_hash_0000000000000000")) + err = erc20shim.ForTestingFinalizeAndConfirmCurrentEpoch( + ctx, platform, + MigrationHoodiChain, + MigrationHoodiEscrow, + 12, + bh, + ) + require.NoError(t, err) + + // Call public action for User A + engineCtx = engCtx(ctx, platform, "0x0000000000000000000000000000000000000000", 4, false) + var proofRowsA int + var amountA string + + r, err = platform.Engine.Call(engineCtx, platform.DB, "", "hoodi_get_withdrawal_proof", + []any{userA}, + func(row *common.Row) error { + proofRowsA++ + amountA = row.Values[5].(*types.Decimal).String() + return nil + }) + require.NoError(t, err) + if r != nil && r.Error != nil { + return r.Error + } + + require.Equal(t, 1, proofRowsA, "User A should have 1 proof") + require.Equal(t, amount50, amountA, "User A amount should be 50 tokens") + + // Call public action for User B + var proofRowsB int + var amountB string + + r, err = platform.Engine.Call(engineCtx, platform.DB, "", "hoodi_get_withdrawal_proof", + []any{userB}, + func(row *common.Row) error { + proofRowsB++ + amountB = row.Values[5].(*types.Decimal).String() + return nil + }) + require.NoError(t, err) + if r != nil && r.Error != nil { + return r.Error + } + + require.Equal(t, 1, proofRowsB, "User B should have 1 proof") + require.Equal(t, amount25, amountB, "User B amount should be 25 tokens") + + t.Logf("✅ Multiple users' withdrawals correctly returned") + t.Logf(" User A: %d proof with amount %s wei", proofRowsA, amountA) + t.Logf(" User B: %d proof with amount %s wei", proofRowsB, amountB) + + return nil + }) +}