Skip to content

Commit 019bf9c

Browse files
committed
generate-wire.py: add --bolt arg, use size->type hacks only when that's specified.
For our own internal comms CSVs, we should always name explicit types. Signed-off-by: Rusty Russell <[email protected]>
1 parent 8741043 commit 019bf9c

File tree

8 files changed

+118
-119
lines changed

8 files changed

+118
-119
lines changed

channeld/channel_wire.csv

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ channel_normal_operation,11001
88
channel_init,1000
99
channel_init,,chain_hash,struct sha256_double
1010
channel_init,,funding_txid,struct sha256_double
11-
channel_init,,funding_txout,2
12-
channel_init,,funding_satoshi,8
11+
channel_init,,funding_txout,u16
12+
channel_init,,funding_satoshi,u64
1313
channel_init,,our_config,struct channel_config
1414
channel_init,,their_config,struct channel_config
15-
channel_init,,feerate_per_kw,4
15+
channel_init,,feerate_per_kw,u32
1616
channel_init,,first_commit_sig,secp256k1_ecdsa_signature
1717
channel_init,,crypto_state,struct crypto_state
18-
channel_init,,remote_fundingkey,33
19-
channel_init,,revocation_basepoint,33
20-
channel_init,,payment_basepoint,33
21-
channel_init,,delayed_payment_basepoint,33
22-
channel_init,,remote_per_commit,33
23-
channel_init,,old_remote_per_commit,33
18+
channel_init,,remote_fundingkey,struct pubkey
19+
channel_init,,revocation_basepoint,struct pubkey
20+
channel_init,,payment_basepoint,struct pubkey
21+
channel_init,,delayed_payment_basepoint,struct pubkey
22+
channel_init,,remote_per_commit,struct pubkey
23+
channel_init,,old_remote_per_commit,struct pubkey
2424
channel_init,,funder,enum side
25-
channel_init,,fee_base,4
26-
channel_init,,fee_proportional,4
27-
channel_init,,local_msatoshi,8
25+
channel_init,,fee_base,u32
26+
channel_init,,fee_proportional,u32
27+
channel_init,,local_msatoshi,u64
2828
channel_init,,seed,struct privkey
2929
channel_init,,local_node_id,struct pubkey
3030
channel_init,,remote_node_id,struct pubkey
31-
channel_init,,commit_msec,4
31+
channel_init,,commit_msec,u32
3232
channel_init,,cltv_delta,u16
3333
channel_init,,last_was_revoke,bool
3434
channel_init,,num_last_sent_commit,u16
@@ -66,32 +66,32 @@ channel_funding_announce_depth,1003
6666

6767
# Tell channel to offer this htlc
6868
channel_offer_htlc,1004
69-
channel_offer_htlc,,amount_msat,8
70-
channel_offer_htlc,,cltv_expiry,4
71-
channel_offer_htlc,,payment_hash,32
69+
channel_offer_htlc,,amount_msat,u64
70+
channel_offer_htlc,,cltv_expiry,u32
71+
channel_offer_htlc,,payment_hash,struct sha256
7272
channel_offer_htlc,,onion_routing_packet,1366*u8
7373

7474
# Reply; synchronous since IDs have to increment.
7575
channel_offer_htlc_reply,1104
76-
channel_offer_htlc_reply,,id,8
76+
channel_offer_htlc_reply,,id,u64
7777
# Zero failure code means success.
78-
channel_offer_htlc_reply,,failure_code,2
79-
channel_offer_htlc_reply,,failurestrlen,2
78+
channel_offer_htlc_reply,,failure_code,u16
79+
channel_offer_htlc_reply,,failurestrlen,u16
8080
channel_offer_htlc_reply,,failurestr,failurestrlen*u8
8181

8282
# Main daemon found out the preimage for an htlc
8383
#include <bitcoin/preimage.h>
8484
channel_fulfill_htlc,1005
85-
channel_fulfill_htlc,,id,8
85+
channel_fulfill_htlc,,id,u64
8686
channel_fulfill_htlc,,payment_preimage,struct preimage
8787

8888
# Main daemon says HTLC failed
8989
channel_fail_htlc,1006
90-
channel_fail_htlc,,id,8
90+
channel_fail_htlc,,id,u64
9191
# If malformed is non-zero, it's a BADONION code
9292
channel_fail_htlc,,malformed,u16
9393
# Otherwise, error_pkt contains failreason.
94-
channel_fail_htlc,,len,2
94+
channel_fail_htlc,,len,u16
9595
channel_fail_htlc,,error_pkt,len*u8
9696

9797
# Ping/pong test.

gossipd/gossip_wire.csv

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
# Peers can give a bad message, we close their fd, but no harm done.
22
gossipstatus_peer_bad_msg,13000
3-
gossipstatus_peer_bad_msg,,unique_id,8
4-
gossipstatus_peer_bad_msg,,len,2
3+
gossipstatus_peer_bad_msg,,unique_id,u64
4+
gossipstatus_peer_bad_msg,,len,u16
55
gossipstatus_peer_bad_msg,,err,len*u8
66

77
# Misc problems like opening control fd.
88
gossipstatus_peer_failed,13001
9-
gossipstatus_peer_failed,,unique_id,8
10-
gossipstatus_peer_failed,,len,2
9+
gossipstatus_peer_failed,,unique_id,u64
10+
gossipstatus_peer_failed,,len,u16
1111
gossipstatus_peer_failed,,err,len*u8
1212

1313
#include <common/cryptomsg.h>
1414

1515
# Initialize the gossip daemon
1616
gossipctl_init,3000
17-
gossipctl_init,,broadcast_interval,4
17+
gossipctl_init,,broadcast_interval,u32
1818
gossipctl_init,,chain_hash,struct sha256_double
1919

2020
# These take an fd, but have no response
2121
# (if it is to move onto a channel, we get a status msg).
2222
gossipctl_new_peer,3001
23-
gossipctl_new_peer,,unique_id,8
23+
gossipctl_new_peer,,unique_id,u64
2424
gossipctl_new_peer,,crypto_state,struct crypto_state
2525

2626
# Tell it to release a peer which has initialized.
2727
gossipctl_release_peer,3002
28-
gossipctl_release_peer,,unique_id,8
28+
gossipctl_release_peer,,unique_id,u64
2929

3030
# This releases the peer and returns the cryptostate (followed two fds: peer and gossip)
3131
gossipctl_release_peer_reply,3102
@@ -36,17 +36,17 @@ gossipctl_release_peer_replyfail,3202
3636

3737
# This is where we save a peer's features.
3838
#gossipstatus_peer_features,3001
39-
#gossipstatus_peer_features,,unique_id,8
40-
#gossipstatus_peer_features,,gflen,2
41-
#gossipstatus_peer_features,,globalfeatures,gflen
42-
#gossipstatus_peer_features,,lflen,2
43-
#gossipstatus_peer_features,,localfeatures,lflen
39+
#gossipstatus_peer_features,,unique_id,u64
40+
#gossipstatus_peer_features,,gflen,u16
41+
#gossipstatus_peer_features,,globalfeatures,gflen*u8
42+
#gossipstatus_peer_features,,lflen,u16
43+
#gossipstatus_peer_features,,localfeatures,lflen*u8
4444

4545
# Peer can send non-gossip packet (usually an open_channel) (followed two fds: peer and gossip)
4646
gossipstatus_peer_nongossip,3004
47-
gossipstatus_peer_nongossip,,unique_id,8
47+
gossipstatus_peer_nongossip,,unique_id,u64
4848
gossipstatus_peer_nongossip,,crypto_state,struct crypto_state
49-
gossipstatus_peer_nongossip,,len,2
49+
gossipstatus_peer_nongossip,,len,u16
5050
gossipstatus_peer_nongossip,,msg,len*u8
5151

5252
# Pass JSON-RPC getnodes call through
@@ -94,12 +94,12 @@ gossip_resolve_channel_reply,,keys,num_keys*struct pubkey
9494
# The main daemon forward some gossip message to gossipd, allows injecting
9595
# arbitrary gossip messages.
9696
gossip_forwarded_msg,3010
97-
gossip_forwarded_msg,,msglen,2
98-
gossip_forwarded_msg,,msg,msglen
97+
gossip_forwarded_msg,,msglen,u16
98+
gossip_forwarded_msg,,msg,msglen*u8
9999

100100
# If peer is still connected, fail it (master does this for reconnect)
101101
gossipctl_fail_peer,3011
102-
gossipctl_fail_peer,,unique_id,8
102+
gossipctl_fail_peer,,unique_id,u64
103103

104104
# Get a gossip fd for this peer (it has reconnected)
105105
gossipctl_get_peer_gossipfd,3012

handshaked/handshake_wire.csv

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ respr_act_three,14013
1010
success,4000
1111

1212
handshake_responder,4001
13-
handshake_responder,,my_id,33
13+
handshake_responder,,my_id,struct pubkey
1414
handshake_responder_reply,4101
15-
handshake_responder_reply,,initiator_id,33
15+
handshake_responder_reply,,initiator_id,struct pubkey
1616
handshake_responder_reply,,cs,struct crypto_state
17-
handshake_responder_reply,,gflen,2
18-
handshake_responder_reply,,globalfeatures,gflen
19-
handshake_responder_reply,,lflen,2
20-
handshake_responder_reply,,localfeatures,lflen
17+
handshake_responder_reply,,gflen,u16
18+
handshake_responder_reply,,globalfeatures,gflen*u8
19+
handshake_responder_reply,,lflen,u16
20+
handshake_responder_reply,,localfeatures,lflen*u8
2121

2222
handshake_initiator,4002
23-
handshake_initiator,,my_id,33
24-
handshake_initiator,,responder_id,33
23+
handshake_initiator,,my_id,struct pubkey
24+
handshake_initiator,,responder_id,struct pubkey
2525

2626
handshake_initiator_reply,4102
2727
handshake_initiator_reply,,cs,struct crypto_state
28-
handshake_initiator_reply,,gflen,2
29-
handshake_initiator_reply,,globalfeatures,gflen
30-
handshake_initiator_reply,,lflen,2
31-
handshake_initiator_reply,,localfeatures,lflen
28+
handshake_initiator_reply,,gflen,u16
29+
handshake_initiator_reply,,globalfeatures,gflen*u8
30+
handshake_initiator_reply,,lflen,u16
31+
handshake_initiator_reply,,localfeatures,lflen*u8

hsmd/hsm_client_wire_csv

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ hsm_ecdh_resp,,ss,struct secret
77
hsm_cannouncement_sig_req,2
88
hsm_cannouncement_sig_req,,bitcoin_id,struct pubkey
99
hsm_cannouncement_sig_req,,calen,u16
10-
hsm_cannouncement_sig_req,,ca,calen
10+
hsm_cannouncement_sig_req,,ca,calen*u8
1111

1212
hsm_cannouncement_sig_reply,102
13-
hsm_cannouncement_sig_reply,,node_signature,64
13+
hsm_cannouncement_sig_reply,,node_signature,secp256k1_ecdsa_signature
1414

1515
hsm_cupdate_sig_req,3
1616
hsm_cupdate_sig_req,,culen,u16
17-
hsm_cupdate_sig_req,,cu,culen
17+
hsm_cupdate_sig_req,,cu,culen*u8
1818

1919
hsm_cupdate_sig_reply,103
2020
hsm_cupdate_sig_reply,,culen,u16
21-
hsm_cupdate_sig_reply,,cu,culen
21+
hsm_cupdate_sig_reply,,cu,culen*u8

hsmd/hsm_wire.csv

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Clients should not give a bad request but not the HSM's decision to crash.
22
hsmstatus_client_bad_request,1000
3-
hsmstatus_client_bad_request,,unique_id,8
4-
hsmstatus_client_bad_request,,len,2
3+
hsmstatus_client_bad_request,,unique_id,u64
4+
hsmstatus_client_bad_request,,len,u16
55
hsmstatus_client_bad_request,,msg,len*u8
66

77
# Start the HSM.
@@ -10,13 +10,13 @@ hsmctl_init,,new,bool
1010

1111
#include <common/bip32.h>
1212
hsmctl_init_reply,101
13-
hsmctl_init_reply,,node_id,33
13+
hsmctl_init_reply,,node_id,struct pubkey
1414
hsmctl_init_reply,,peer_seed,struct secret
1515
hsmctl_init_reply,,bip32,struct ext_key
1616

1717
# ECDH returns an fd.
1818
hsmctl_hsmfd_ecdh,3
19-
hsmctl_hsmfd_ecdh,,unique_id,8
19+
hsmctl_hsmfd_ecdh,,unique_id,u64
2020

2121
# No contents, just an fd.
2222
hsmctl_hsmfd_ecdh_fd_reply,103
@@ -25,42 +25,42 @@ hsmctl_hsmfd_ecdh_fd_reply,103
2525
#include <common/utxo.h>
2626
# FIXME: This should also take their commit sig & details, to verify.
2727
hsmctl_sign_funding,4
28-
hsmctl_sign_funding,,satoshi_out,8
29-
hsmctl_sign_funding,,change_out,8
30-
hsmctl_sign_funding,,change_keyindex,4
31-
hsmctl_sign_funding,,our_pubkey,33
32-
hsmctl_sign_funding,,their_pubkey,33
33-
hsmctl_sign_funding,,num_inputs,2
28+
hsmctl_sign_funding,,satoshi_out,u64
29+
hsmctl_sign_funding,,change_out,u64
30+
hsmctl_sign_funding,,change_keyindex,u32
31+
hsmctl_sign_funding,,our_pubkey,struct pubkey
32+
hsmctl_sign_funding,,their_pubkey,struct pubkey
33+
hsmctl_sign_funding,,num_inputs,u16
3434
hsmctl_sign_funding,,inputs,num_inputs*struct utxo
3535

3636
hsmctl_sign_funding_reply,104
37-
hsmctl_sign_funding_reply,,num_sigs,2
37+
hsmctl_sign_funding_reply,,num_sigs,u16
3838
hsmctl_sign_funding_reply,,sig,num_sigs*secp256k1_ecdsa_signature
3939

4040
# Request a client socket for a `channeld`, allows signing announcements
4141
hsmctl_hsmfd_channeld,5
42-
hsmctl_hsmfd_channeld,,unique_id,8
42+
hsmctl_hsmfd_channeld,,unique_id,u64
4343

4444
# Empty reply, just an fd
4545
hsmctl_hsmfd_channeld_reply,105
4646

4747
# Master asks the HSM to sign a node_announcement
4848
hsmctl_node_announcement_sig_req,6
49-
hsmctl_node_announcement_sig_req,,annlen,2
49+
hsmctl_node_announcement_sig_req,,annlen,u16
5050
hsmctl_node_announcement_sig_req,,announcement,annlen*u8
5151

5252
hsmctl_node_announcement_sig_reply,106
5353
hsmctl_node_announcement_sig_reply,,signature,secp256k1_ecdsa_signature
5454

5555
# Sign a withdrawal request
5656
hsmctl_sign_withdrawal,7
57-
hsmctl_sign_withdrawal,,satoshi_out,8
58-
hsmctl_sign_withdrawal,,change_out,8
59-
hsmctl_sign_withdrawal,,change_keyindex,4
57+
hsmctl_sign_withdrawal,,satoshi_out,u64
58+
hsmctl_sign_withdrawal,,change_out,u64
59+
hsmctl_sign_withdrawal,,change_keyindex,u32
6060
hsmctl_sign_withdrawal,,pkh,20*u8
61-
hsmctl_sign_withdrawal,,num_inputs,2
61+
hsmctl_sign_withdrawal,,num_inputs,u16
6262
hsmctl_sign_withdrawal,,inputs,num_inputs*struct utxo
6363

6464
hsmctl_sign_withdrawal_reply,107
65-
hsmctl_sign_withdrawal_reply,,num_sigs,2
65+
hsmctl_sign_withdrawal_reply,,num_sigs,u16
6666
hsmctl_sign_withdrawal_reply,,sig,num_sigs*secp256k1_ecdsa_signature

openingd/opening_wire.csv

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
#include <common/channel_config.h>
33
opening_init,6000
44
# Which network are we configured for (as index into the chainparams)?
5-
opening_init,,network_index,4
5+
opening_init,,network_index,u32
66
# Base configuration we'll offer (channel reserve will vary with amount)
77
opening_init,,our_config,struct channel_config
88
# Minimum/maximum configuration values we'll accept
9-
opening_init,,max_to_self_delay,4
10-
opening_init,,min_effective_htlc_capacity_msat,8
9+
opening_init,,max_to_self_delay,u32
10+
opening_init,,min_effective_htlc_capacity_msat,u64
1111
opening_init,,crypto_state,struct crypto_state
1212
# Seed to generate all the keys from
1313
opening_init,,seed,struct privkey
@@ -16,10 +16,10 @@ opening_init,,seed,struct privkey
1616
#include <common/htlc_wire.h>
1717
# This means we offer the open.
1818
opening_funder,6001
19-
opening_funder,,funding_satoshis,8
20-
opening_funder,,push_msat,8
21-
opening_funder,,feerate_per_kw,4
22-
opening_funder,,max_minimum_depth,4
19+
opening_funder,,funding_satoshis,u64
20+
opening_funder,,push_msat,u64
21+
opening_funder,,feerate_per_kw,u32
22+
opening_funder,,max_minimum_depth,u32
2323
opening_funder,,change_satoshis,u64
2424
opening_funder,,change_keyindex,u32
2525
opening_funder,,channel_flags,u8
@@ -34,21 +34,21 @@ opening_funder_reply,,their_config,struct channel_config
3434
opening_funder_reply,,first_commit,struct bitcoin_tx
3535
opening_funder_reply,,first_commit_sig,secp256k1_ecdsa_signature
3636
opening_funder_reply,,crypto_state,struct crypto_state
37-
opening_funder_reply,,revocation_basepoint,33
38-
opening_funder_reply,,payment_basepoint,33
39-
opening_funder_reply,,delayed_payment_basepoint,33
40-
opening_funder_reply,,their_per_commit_point,33
41-
opening_funder_reply,,minimum_depth,4
42-
opening_funder_reply,,remote_fundingkey,33
37+
opening_funder_reply,,revocation_basepoint,struct pubkey
38+
opening_funder_reply,,payment_basepoint,struct pubkey
39+
opening_funder_reply,,delayed_payment_basepoint,struct pubkey
40+
opening_funder_reply,,their_per_commit_point,struct pubkey
41+
opening_funder_reply,,minimum_depth,u32
42+
opening_funder_reply,,remote_fundingkey,struct pubkey
4343
opening_funder_reply,,funding_txid,struct sha256_double
44-
opening_funder_reply,,feerate_per_kw,4
44+
opening_funder_reply,,feerate_per_kw,u32
4545

4646
# This means they offer the open (contains their offer packet)
4747
opening_fundee,6003
48-
opening_fundee,,minimum_depth,4
49-
opening_fundee,,min_feerate,4
50-
opening_fundee,,max_feerate,4
51-
opening_fundee,,len,2
48+
opening_fundee,,minimum_depth,u32
49+
opening_fundee,,min_feerate,u32
50+
opening_fundee,,max_feerate,u32
51+
opening_fundee,,len,u16
5252
opening_fundee,,msg,len*u8
5353

5454
# This gives their txid and info, means we can send funding_signed: we're done.
@@ -57,17 +57,17 @@ opening_fundee_reply,,their_config,struct channel_config
5757
opening_fundee_reply,,first_commit,struct bitcoin_tx
5858
opening_fundee_reply,,first_commit_sig,secp256k1_ecdsa_signature
5959
opening_fundee_reply,,crypto_state,struct crypto_state
60-
opening_fundee_reply,,revocation_basepoint,33
61-
opening_fundee_reply,,payment_basepoint,33
62-
opening_fundee_reply,,delayed_payment_basepoint,33
63-
opening_fundee_reply,,their_per_commit_point,33
64-
opening_fundee_reply,,remote_fundingkey,33
60+
opening_fundee_reply,,revocation_basepoint,struct pubkey
61+
opening_fundee_reply,,payment_basepoint,struct pubkey
62+
opening_fundee_reply,,delayed_payment_basepoint,struct pubkey
63+
opening_fundee_reply,,their_per_commit_point,struct pubkey
64+
opening_fundee_reply,,remote_fundingkey,struct pubkey
6565
opening_fundee_reply,,funding_txid,struct sha256_double
6666
opening_fundee_reply,,funding_txout,u16
67-
opening_fundee_reply,,funding_satoshis,8
68-
opening_fundee_reply,,push_msat,8
67+
opening_fundee_reply,,funding_satoshis,u64
68+
opening_fundee_reply,,push_msat,u64
6969
opening_fundee_reply,,channel_flags,u8
70-
opening_fundee_reply,,feerate_per_kw,4
70+
opening_fundee_reply,,feerate_per_kw,u32
7171
# The (encrypted) funding signed message: send this and we're committed.
7272
opening_fundee_reply,,msglen,u16
7373
opening_fundee_reply,,funding_signed_msg,msglen*u8

0 commit comments

Comments
 (0)