mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
bugfixes + tonlib update
This commit is contained in:
parent
2f81361a02
commit
eecf05ca59
35 changed files with 734 additions and 193 deletions
|
@ -30,6 +30,7 @@ td::Ref<vm::Cell> Config::serialize() const {
|
|||
rec.init_timeout = init_timeout;
|
||||
rec.close_timeout = close_timeout;
|
||||
rec.channel_id = channel_id;
|
||||
rec.min_A_extra = pack_grams(min_A_extra);
|
||||
|
||||
td::Ref<vm::Cell> res;
|
||||
CHECK(tlb::pack_cell(res, rec));
|
||||
|
@ -94,6 +95,13 @@ td::Ref<vm::Cell> MsgTimeout::serialize() const {
|
|||
return res;
|
||||
}
|
||||
|
||||
td::Ref<vm::Cell> MsgPayout::serialize() const {
|
||||
block::gen::ChanMsg::Record_chan_msg_payout rec;
|
||||
td::Ref<vm::Cell> res;
|
||||
CHECK(tlb::pack_cell(res, rec));
|
||||
return res;
|
||||
}
|
||||
|
||||
td::SecureString SignedPromise::signature(const td::Ed25519::PrivateKey* key, const td::Ref<vm::Cell>& promise) {
|
||||
return sign(promise, key);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ struct Config {
|
|||
block::StdAddress a_addr;
|
||||
block::StdAddress b_addr;
|
||||
td::uint64 channel_id{0};
|
||||
td::uint64 min_A_extra{0};
|
||||
|
||||
td::Ref<vm::Cell> serialize() const;
|
||||
};
|
||||
|
@ -59,6 +60,10 @@ struct MsgTimeout {
|
|||
td::Ref<vm::Cell> serialize() const;
|
||||
};
|
||||
|
||||
struct MsgPayout {
|
||||
td::Ref<vm::Cell> serialize() const;
|
||||
};
|
||||
|
||||
struct SignedPromise {
|
||||
Promise promise;
|
||||
td::optional<td::SecureString> o_signature;
|
||||
|
@ -125,8 +130,11 @@ struct MsgBuilder {
|
|||
rec.msg = vm::load_cell_slice_ref(msg);
|
||||
rec.sig_A = maybe_ref(maybe_sign(msg, a_key));
|
||||
rec.sig_B = maybe_ref(maybe_sign(msg, b_key));
|
||||
block::gen::ChanOp::Record op_rec;
|
||||
CHECK(tlb::csr_pack(op_rec.msg, rec));
|
||||
LOG(ERROR) << op_rec.msg->size();
|
||||
td::Ref<vm::Cell> res;
|
||||
CHECK(tlb::pack_cell(res, rec));
|
||||
CHECK(tlb::pack_cell(res, op_rec));
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
@ -160,6 +168,10 @@ struct MsgTimeoutBuilder : public MsgBuilder<MsgTimeoutBuilder> {
|
|||
MsgTimeout msg;
|
||||
};
|
||||
|
||||
struct MsgPayoutBuilder : public MsgBuilder<MsgPayoutBuilder> {
|
||||
MsgPayout msg;
|
||||
};
|
||||
|
||||
struct MsgCloseBuilder : public MsgBuilder<MsgCloseBuilder> {
|
||||
MsgClose msg;
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ td::Span<int> SmartContractCode::get_revisions(Type type) {
|
|||
return res;
|
||||
}
|
||||
case Type::RestrictedWallet: {
|
||||
static int res[] = {-1, 1};
|
||||
static int res[] = {1};
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ td::Ref<vm::Cell> TestWallet::get_init_state(const td::Ed25519::PublicKey& publi
|
|||
return GenericAccount::get_init_state(std::move(code), std::move(data));
|
||||
}
|
||||
|
||||
td::Ref<vm::Cell> TestWallet::get_init_message(const td::Ed25519::PrivateKey& private_key) noexcept {
|
||||
td::Ref<vm::Cell> TestWallet::get_init_message_new(const td::Ed25519::PrivateKey& private_key) noexcept {
|
||||
std::string seq_no(4, 0);
|
||||
auto signature =
|
||||
private_key.sign(vm::CellBuilder().store_bytes(seq_no).finalize()->get_hash().as_slice()).move_as_ok();
|
||||
|
|
|
@ -36,7 +36,7 @@ class TestWallet : public ton::SmartContract, public WalletInterface {
|
|||
static constexpr unsigned max_message_size = vm::CellString::max_bytes;
|
||||
static constexpr unsigned max_gifts_size = 1;
|
||||
static td::Ref<vm::Cell> get_init_state(const td::Ed25519::PublicKey& public_key, td::int32 revision = 0) noexcept;
|
||||
static td::Ref<vm::Cell> get_init_message(const td::Ed25519::PrivateKey& private_key) noexcept;
|
||||
static td::Ref<vm::Cell> get_init_message_new(const td::Ed25519::PrivateKey& private_key) noexcept;
|
||||
static td::Ref<vm::Cell> make_a_gift_message_static(const td::Ed25519::PrivateKey& private_key, td::uint32 seqno,
|
||||
td::Span<Gift> gifts) noexcept;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ td::Ref<vm::Cell> Wallet::get_init_state(const td::Ed25519::PublicKey& public_ke
|
|||
return GenericAccount::get_init_state(std::move(code), std::move(data));
|
||||
}
|
||||
|
||||
td::Ref<vm::Cell> Wallet::get_init_message(const td::Ed25519::PrivateKey& private_key) noexcept {
|
||||
td::Ref<vm::Cell> Wallet::get_init_message_new(const td::Ed25519::PrivateKey& private_key) noexcept {
|
||||
td::uint32 seqno = 0;
|
||||
td::uint32 valid_until = std::numeric_limits<td::uint32>::max();
|
||||
auto signature =
|
||||
|
|
|
@ -36,7 +36,7 @@ class Wallet : public ton::SmartContract, public WalletInterface {
|
|||
static constexpr unsigned max_message_size = vm::CellString::max_bytes;
|
||||
static constexpr unsigned max_gifts_size = 4;
|
||||
static td::Ref<vm::Cell> get_init_state(const td::Ed25519::PublicKey& public_key, td::int32 revision = 0) noexcept;
|
||||
static td::Ref<vm::Cell> get_init_message(const td::Ed25519::PrivateKey& private_key) noexcept;
|
||||
static td::Ref<vm::Cell> get_init_message_new(const td::Ed25519::PrivateKey& private_key) noexcept;
|
||||
static td::Ref<vm::Cell> make_a_gift_message(const td::Ed25519::PrivateKey& private_key, td::uint32 seqno,
|
||||
td::uint32 valid_until, td::Span<Gift> gifts) noexcept;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue