text:
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2021 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <script/sign.h>

#include <consensus/amount.h>
#include <key.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <script/keyorigin.h>
#include <script/signingprovider.h>
#include <script/standard.h>
#include <uint256.h>
#include <util/translation.h>
#include <util/vector.h>

typedef std::vector<unsigned char> valtype;

MutableTransactionSignatureCreator::MutableTransactionSignatureCreator(const CMutableTransaction* tx, unsigned int input_idx, const CAmount& amount, int hash_type)
    : txTo{tx}, nIn{input_idx}, nHashType{hash_type}, amount{amount}, checker{txTo, nIn, amount, MissingDataBehavior::FAIL},
      m_txdata(nullptr)
{
}

MutableTransactionSignatureCreator::MutableTransactionSignatureCreator(const CMutableTransaction* tx, unsigned int input_idx, const CAmount& amount, const PrecomputedTransactionData* txdata, int hash_type)
    : txTo{tx}, nIn{input_idx}, nHashType{hash_type}, amount{amount},
      checker{txdata ? MutableTransactionSignatureChecker{txTo, nIn, amount, *txdata, MissingDataBehavior::FAIL} :
                       MutableTransactionSignatureChecker{txTo, nIn, amount, MissingDataBehavior::FAIL}},
      m_txdata(txdata)
{
}

bool MutableTransactionSignatureCreator::CreateSig(const SigningProvider& provider, std::vector<unsigned char>& vchSig, const CKeyID& address, const CScript& scriptCode, SigVersion sigversion) const
{
    assert(sigversion == SigVersion::BASE || sigversion == SigVersion::WITNESS_V0);

    CKey key;
    if (!provider.GetKey(address, key))
        return false;

    // Signing with uncompressed keys is disabled in witness scripts
    if (sigversion == SigVersion::WITNESS_V0 && !key.IsCompressed())
        return false;

    // Signing without known amount does not work in witness scripts.
    if (sigversion == SigVersion::WITNESS_V0 && !MoneyRange(amount)) return false;

    // BASE/WITNESS_V0 signatures don't support explicit SIGHASH_DEFAULT, use SIGHASH_ALL instead.
    const int hashtype = nHashType == SIGHASH_DEFAULT ? SIGHASH_ALL : nHashType;

    uint256 hash = SignatureHash(scriptCode, *txTo, nIn, hashtype, amount, sigversion, m_txdata);
    if (!key.Sign(hash, vchSig))
        return false;
    vchSig.push_back((unsigned char)hashtype);
    return true;
}

bool MutableTransactionSignatureCreator::CreateSchnorrSig(const SigningProvider& provider, std::vector<unsigned char>& sig, const XOnlyPubKey& pubkey, const uint256* leaf_hash, const uint256* merkle_root, SigVersion sigversion) const
{
    assert(sigversion == SigVersion::TAPROOT || sigversion == SigVersion::TAPSCRIPT);

    CKey key;
    if (!provider.GetKeyByXOnly(pubkey, key)) return false;

    // BIP341/BIP342 signing needs lots of precomputed transaction data. While some
    // (non-SIGHASH_DEFAULT) sighash modes exist that can work with just some subset
    // of data present, for now, only support signing when everything is provided.
    if (!m_txdata || !m_txdata->m_bip341_taproot_ready || !m_txdata->m_spent_outputs_ready) return false;

    ScriptExecutionData execdata;
    execdata.m_annex_init = true;
    execdata.m_annex_present = false; // Only support annex-less signing for now.
    if (sigversion == SigVersion::TAPSCRIPT) {
        execdata.m_codeseparator_pos_init = true;
        execdata.m_codeseparator_pos = 0xFFFFFFFF; // Only support non-OP_CODESEPARATOR BIP342 signing for now.
        if (!leaf_hash) return false; // BIP342 signing needs leaf hash.
        execdata.m_tapleaf_hash_init = true;
        execdata.m_tapleaf_hash = *leaf_hash;
    }
    uint256 hash;
    if (!SignatureHashSchnorr(hash, execdata, *txTo, nIn, nHashType, sigversion, *m_txdata, MissingDataBehavior::FAIL)) return false;
    sig.resize(64);
    // Use uint256{} as aux_rnd for now.
    if (!key.SignSchnorr(hash, sig, merkle_root, {})) return false;
    if (nHashType) sig.push_back(nHashType);
    return true;
}

static bool GetCScript(const SigningProvider& provider, const SignatureData& sigdata, const CScriptID& scriptid, CScript& script)
{
    if (provider.GetCScript(scriptid, script)) {
        return true;
    }
    // Look for scripts in SignatureData
    if (CScriptID(sigdata.redeem_script) == scriptid) {
        script = sigdata.redeem_script;
        return true;
    } else if (CScriptID(sigdata.witness_script) == scriptid) {
        script = sigdata.witness_script;
        return true;
    }
    return false;
}

static bool GetPubKey(const SigningProvider& provider, const SignatureData& sigdata, const CKeyID& address, CPubKey& pubkey)
{
    // Look for pubkey in all partial sigs
    const auto it = sigdata.signatures.find(address);
    if (it != sigdata.signatures.end()) {
        pubkey = it->second.first;
        return true;
    }
    // Look for pubkey in pubkey list
    const auto& pk_it = sigdata.misc_pubkeys.find(address);
    if (pk_it != sigdata.misc_pubkeys.end()) {
        pubkey = pk_it->second.first;
        return true;
    }
    // Query the underlying provider
    return provider.GetPubKey(address, pubkey);
}

static bool CreateSig(const BaseSignatureCreator& creator, SignatureData& sigdata, const SigningProvider& provider, std::vector<unsigned char>& sig_out, const CPubKey& pubkey, const CScript& scriptcode, SigVersion sigversion)
{
    CKeyID keyid = pubkey.GetID();
    const auto it = sigdata.signatures.find(keyid);
    if (it != sigdata.signatures.end()) {
        sig_out = it->second.second;
        return true;
    }
    KeyOriginInfo info;
    if (provider.GetKeyOrigin(keyid, info)) {
        sigdata.misc_pubkeys.emplace(keyid, std::make_pair(pubkey, std::move(info)));
    }
    if (creator.CreateSig(provider, sig_out, keyid, scriptcode, sigversion)) {
        auto i = sigdata.signatures.emplace(keyid, SigPair(pubkey, sig_out));
        assert(i.second);
        return true;
    }
    // Could not make signature or signature not found, add keyid to missing
    sigdata.missing_sigs.push_back(keyid);
    return false;
}

static bool CreateTaprootScriptSig(const BaseSignatureCreator& creator, SignatureData& sigdata, const SigningProvider& provider, std::vector<unsigned char>& sig_out, const XOnlyPubKey& pubkey, const uint256& leaf_hash, SigVersion sigversion)
{
    auto lookup_key = std::make_pair(pubkey, leaf_hash);
    auto it = sigdata.taproot_script_sigs.find(lookup_key);
    if (it != sigdata.taproot_script_sigs.end()) {
        sig_out = it->second;
    }
    if (creator.CreateSchnorrSig(provider, sig_out, pubkey, &leaf_hash, nullptr, sigversion)) {
        sigdata.taproot_script_sigs[lookup_key] = sig_out;
        return true;
    }
    return false;
}

static bool SignTaprootScript(const SigningProvider& provider, const BaseSignatureCreator& creator, SignatureData& sigdata, int leaf_version, const CScript& script, std::vector<valtype>& result)
{
    // Only BIP342 tapscript signing is supported for now.
    if (leaf_version != TAPROOT_LEAF_TAPSCRIPT) return false;
    SigVersion sigversion = SigVersion::TAPSCRIPT;

    uint256 leaf_hash = (CHashWriter(HASHER_TAPLEAF) << uint8_t(leaf_version) << script).GetSHA256();

    // <xonly pubkey> OP_CHECKSIG
    if (script.size() == 34 && script[33] == OP_CHECKSIG && script[0] == 0x20) {
        XOnlyPubKey pubkey{Span{script}.subspan(1, 32)};
        std::vector<unsigned char> sig;
        if (CreateTaprootScriptSig(creator, sigdata, provider, sig, pubkey, leaf_hash, sigversion)) {
            result = Vector(std::move(sig));
            return true;
        }
        return false;
    }

    // multi_a scripts (<key> OP_CHECKSIG <key> OP_CHECKSIGADD <key> OP_CHECKSIGADD <k> OP_NUMEQUAL)
    if (auto match = MatchMultiA(script)) {
        std::vector<std::vector<unsigned char>> sigs;
        int good_sigs = 0;
        for (size_t i = 0; i < match->second.size(); ++i) {
            XOnlyPubKey pubkey{*(match->second.rbegin() + i)};
            std::vector<unsigned char> sig;
            bool good_sig = CreateTaprootScriptSig(creator, sigdata, provider, sig, pubkey, leaf_hash, sigversion);
            if (good_sig && good_sigs < match->first) {
                ++good_sigs;
                sigs.push_back(std::move(sig));
            } else {
                sigs.emplace_back();
            }
        }
        if (good_sigs == match->first) {
            result = std::move(sigs);
            return true;
        }
        return false;
    }

    return false;
}

static bool SignTaproot(const SigningProvider& provider, const BaseSignatureCreator& creator, const WitnessV1Taproot& output, SignatureData& sigdata, std::vector<valtype>& result)
{
    TaprootSpendData spenddata;

    // Gather information about this output.
    if (provider.GetTaprootSpendData(output, spenddata)) {
        sigdata.tr_spenddata.Merge(spenddata);
    }

    // Try key path spending.
    {
        std::vector<unsigned char> sig;
        if (sigdata.taproot_key_path_sig.size() == 0) {
            if (creator.CreateSchnorrSig(provider, sig, spenddata.internal_key, nullptr, &spenddata.merkle_root, SigVersion::TAPROOT)) {
                sigdata.taproot_key_path_sig = sig;
            }
        }
        if (sigdata.taproot_key_path_sig.size()) {
            result = Vector(sigdata.taproot_key_path_sig);
            return true;
        }
    }

    // Try script path spending.
    std::vector<std::vector<unsigned char>> smallest_result_stack;
    for (const auto& [key, control_blocks] : sigdata.tr_spenddata.scripts) {
        const auto& [script, leaf_ver] = key;
        std::vector<std::vector<unsigned char>> result_stack;
        if (SignTaprootScript(provider, creator, sigdata, leaf_ver, script, result_stack)) {
            result_stack.emplace_back(std::begin(script), std::end(script)); // Push the script
            result_stack.push_back(*control_blocks.begin()); // Push the smallest control block
            if (smallest_result_stack.size() == 0 ||
                GetSerializeSize(result_stack, PROTOCOL_VERSION) < GetSerializeSize(smallest_result_stack, PROTOCOL_VERSION)) {
                smallest_result_stack = std::move(result_stack);
            }
        }
    }
    if (smallest_result_stack.size() != 0) {
        result = std::move(smallest_result_stack);
        return true;
    }

    return false;
}

/**
 * Sign scriptPubKey using signature made with creator.
 * Signatures are returned in scriptSigRet (or returns false if scriptPubKey can't be signed),
 * unless whichTypeRet is TxoutType::SCRIPTHASH, in which case scriptSigRet is the redemption script.
 * Returns false if scriptPubKey could not be completely satisfied.
 */
static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator& creator, const CScript& scriptPubKey,
                     std::vector<valtype>& ret, TxoutType& whichTypeRet, SigVersion sigversion, SignatureData& sigdata)
{
    CScript scriptRet;
    uint160 h160;
    ret.clear();
    std::vector<unsigned char> sig;

    std::vector<valtype> vSolutions;
    whichTypeRet = Solver(scriptPubKey, vSolutions);

    switch (whichTypeRet) {
    case TxoutType::NONSTANDARD:
    case TxoutType::NULL_DATA:
    case TxoutType::WITNESS_UNKNOWN:
        return false;
    case TxoutType::PUBKEY:
        if (!CreateSig(creator, sigdata, provider, sig, CPubKey(vSolutions[0]), scriptPubKey, sigversion)) return false;
        ret.push_back(std::move(sig));
        return true;
    case TxoutType::PUBKEYHASH: {
        CKeyID keyID = CKeyID(uint160(vSolutions[0]));
        CPubKey pubkey;
        if (!GetPubKey(provider, sigdata, keyID, pubkey)) {
            // Pubkey could not be found, add to missing
            sigdata.missing_pubkeys.push_back(keyID);
            return false;
        }
        if (!CreateSig(creator, sigdata, provider, sig, pubkey, scriptPubKey, sigversion)) return false;
        ret.push_back(std::move(sig));
        ret.push_back(ToByteVector(pubkey));
        return true;
    }
    case TxoutType::SCRIPTHASH:
        h160 = uint160(vSolutions[0]);
        if (GetCScript(provider, sigdata, CScriptID{h160}, scriptRet)) {
            ret.push_back(std::vector<unsigned char>(scriptRet.begin(), scriptRet.end()));
            return true;
        }
        // Could not find redeemScript, add to missing
        sigdata.missing_redeem_script = h160;
        return false;

    case TxoutType::MULTISIG: {
        size_t required = vSolutions.front()[0];
        ret.push_back(valtype()); // workaround CHECKMULTISIG bug
        for (size_t i = 1; i < vSolutions.size() - 1; ++i) {
            CPubKey pubkey = CPubKey(vSolutions[i]);
            // We need to always call CreateSig in order to fill sigdata with all
            // possible signatures that we can create. This will allow further PSBT
            // processing to work as it needs all possible signature and pubkey pairs
            if (CreateSig(creator, sigdata, provider, sig, pubkey, scriptPubKey, sigversion)) {
                if (ret.size() < required + 1) {
                    ret.push_back(std::move(sig));
                }
            }
        }
        bool ok = ret.size() == required + 1;
        for (size_t i = 0; i + ret.size() < required + 1; ++i) {
            ret.push_back(valtype());
        }
        return ok;
    }
    case TxoutType::WITNESS_V0_KEYHASH:
        ret.push_back(vSolutions[0]);
        return true;

    case TxoutType::WITNESS_V0_SCRIPTHASH:
        CRIPEMD160().Write(vSolutions[0].data(), vSolutions[0].size()).Finalize(h160.begin());
        if (GetCScript(provider, sigdata, CScriptID{h160}, scriptRet)) {
            ret.push_back(std::vector<unsigned char>(scriptRet.begin(), scriptRet.end()));
            return true;
        }
        // Could not find witnessScript, add to missing
        sigdata.missing_witness_script = uint256(vSolutions[0]);
        return false;

    case TxoutType::WITNESS_V1_TAPROOT:
        return SignTaproot(provider, creator, WitnessV1Taproot(XOnlyPubKey{vSolutions[0]}), sigdata, ret);
    } // no default case, so the compiler can warn about missing cases
    assert(false);
}

static CScript PushAll(const std::vector<valtype>& values)
{
    CScript result;
    for (const valtype& v : values) {
        if (v.size() == 0) {
            result << OP_0;
        } else if (v.size() == 1 && v[0] >= 1 && v[0] <= 16) {
            result << CScript::EncodeOP_N(v[0]);
        } else if (v.size() == 1 && v[0] == 0x81) {
            result << OP_1NEGATE;
        } else {
            result << v;
        }
    }
    return result;
}

bool ProduceSignature(const SigningProvider& provider, const BaseSignatureCreator& creator, const CScript& fromPubKey, SignatureData& sigdata)
{
    if (sigdata.complete) return true;

    std::vector<valtype> result;
    TxoutType whichType;
    bool solved = SignStep(provider, creator, fromPubKey, result, whichType, SigVersion::BASE, sigdata);
    bool P2SH = false;
    CScript subscript;

    if (solved && whichType == TxoutType::SCRIPTHASH)
    {
        // Solver returns the subscript that needs to be evaluated;
        // the final scriptSig is the signatures from that
        // and then the serialized subscript:
        subscript = CScript(result[0].begin(), result[0].end());
        sigdata.redeem_script = subscript;
        solved = solved && SignStep(provider, creator, subscript, result, whichType, SigVersion::BASE, sigdata) && whichType != TxoutType::SCRIPTHASH;
        P2SH = true;
    }

    if (solved && whichType == TxoutType::WITNESS_V0_KEYHASH)
    {
        CScript witnessscript;
        witnessscript << OP_DUP << OP_HASH160 << ToByteVector(result[0]) << OP_EQUALVERIFY << OP_CHECKSIG;
        TxoutType subType;
        solved = solved && SignStep(provider, creator, witnessscript, result, subType, SigVersion::WITNESS_V0, sigdata);
        sigdata.scriptWitness.stack = result;
        sigdata.witness = true;
        result.clear();
    }
    else if (solved && whichType == TxoutType::WITNESS_V0_SCRIPTHASH)
    {
        CScript witnessscript(result[0].begin(), result[0].end());
        sigdata.witness_script = witnessscript;
        TxoutType subType;
        solved = solved && SignStep(provider, creator, witnessscript, result, subType, SigVersion::WITNESS_V0, sigdata) && subType != TxoutType::SCRIPTHASH && subType != TxoutType::WITNESS_V0_SCRIPTHASH && subType != TxoutType::WITNESS_V0_KEYHASH;
        result.push_back(std::vector<unsigned char>(witnessscript.begin(), witnessscript.end()));
        sigdata.scriptWitness.stack = result;
        sigdata.witness = true;
        result.clear();
    } else if (whichType == TxoutType::WITNESS_V1_TAPROOT && !P2SH) {
        sigdata.witness = true;
        if (solved) {
            sigdata.scriptWitness.stack = std::move(result);
        }
        result.clear();
    } else if (solved && whichType == TxoutType::WITNESS_UNKNOWN) {
        sigdata.witness = true;
    }

    if (!sigdata.witness) sigdata.scriptWitness.stack.clear();
    if (P2SH) {
        result.push_back(std::vector<unsigned char>(subscript.begin(), subscript.end()));
    }
    sigdata.scriptSig = PushAll(result);

    // Test solution
    sigdata.complete = solved && VerifyScript(sigdata.scriptSig, fromPubKey, &sigdata.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS, creator.Checker());
    return sigdata.complete;
}

namespace {
class SignatureExtractorChecker final : public DeferringSignatureChecker
{
private:
    SignatureData& sigdata;

public:
    SignatureExtractorChecker(SignatureData& sigdata, BaseSignatureChecker& checker) : DeferringSignatureChecker(checker), sigdata(sigdata) {}

    bool CheckECDSASignature(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const override
    {
        if (m_checker.CheckECDSASignature(scriptSig, vchPubKey, scriptCode, sigversion)) {
            CPubKey pubkey(vchPubKey);
            sigdata.signatures.emplace(pubkey.GetID(), SigPair(pubkey, scriptSig));
            return true;
        }
        return false;
    }
};

struct Stacks
{
    std::vector<valtype> script;
    std::vector<valtype> witness;

    Stacks() = delete;
    Stacks(const Stacks&) = delete;
    explicit Stacks(const SignatureData& data) : witness(data.scriptWitness.stack) {
        EvalScript(script, data.scriptSig, SCRIPT_VERIFY_STRICTENC, BaseSignatureChecker(), SigVersion::BASE);
    }
};
}

// Extracts signatures and scripts from incomplete scriptSigs. Please do not extend this, use PSBT instead
SignatureData DataFromTransaction(const CMutableTransaction& tx, unsigned int nIn, const CTxOut& txout)
{
    SignatureData data;
    assert(tx.vin.size() > nIn);
    data.scriptSig = tx.vin[nIn].scriptSig;
    data.scriptWitness = tx.vin[nIn].scriptWitness;
    Stacks stack(data);

    // Get signatures
    MutableTransactionSignatureChecker tx_checker(&tx, nIn, txout.nValue, MissingDataBehavior::FAIL);
    SignatureExtractorChecker extractor_checker(data, tx_checker);
    if (VerifyScript(data.scriptSig, txout.scriptPubKey, &data.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS, extractor_checker)) {
        data.complete = true;
        return data;
    }

    // Get scripts
    std::vector<std::vector<unsigned char>> solutions;
    TxoutType script_type = Solver(txout.scriptPubKey, solutions);
    SigVersion sigversion = SigVersion::BASE;
    CScript next_script = txout.scriptPubKey;

    if (script_type == TxoutType::SCRIPTHASH && !stack.script.empty() && !stack.script.back().empty()) {
        // Get the redeemScript
        CScript redeem_script(stack.script.back().begin(), stack.script.back().end());
        data.redeem_script = redeem_script;
        next_script = std::move(redeem_script);

        // Get redeemScript type
        script_type = Solver(next_script, solutions);
        stack.script.pop_back();
    }
    if (script_type == TxoutType::WITNESS_V0_SCRIPTHASH && !stack.witness.empty() && !stack.witness.back().empty()) {
        // Get the witnessScript
        CScript witness_script(stack.witness.back().begin(), stack.witness.back().end());
        data.witness_script = witness_script;
        next_script = std::move(witness_script);

        // Get witnessScript type
        script_type = Solver(next_script, solutions);
        stack.witness.pop_back();
        stack.script = std::move(stack.witness);
        stack.witness.clear();
        sigversion = SigVersion::WITNESS_V0;
    }
    if (script_type == TxoutType::MULTISIG && !stack.script.empty()) {
        // Build a map of pubkey -> signature by matching sigs to pubkeys:
        assert(solutions.size() > 1);
        unsigned int num_pubkeys = solutions.size()-2;
        unsigned int last_success_key = 0;
        for (const valtype& sig : stack.script) {
            for (unsigned int i = last_success_key; i < num_pubkeys; ++i) {
                const valtype& pubkey = solutions[i+1];
                // We either have a signature for this pubkey, or we have found a signature and it is valid
                if (data.signatures.count(CPubKey(pubkey).GetID()) || extractor_checker.CheckECDSASignature(sig, pubkey, next_script, sigversion)) {
                    last_success_key = i + 1;
                    break;
                }
            }
        }
    }

    return data;
}

void UpdateInput(CTxIn& input, const SignatureData& data)
{
    input.scriptSig = data.scriptSig;
    input.scriptWitness = data.scriptWitness;
}

void SignatureData::MergeSignatureData(SignatureData sigdata)
{
    if (complete) return;
    if (sigdata.complete) {
        *this = std::move(sigdata);
        return;
    }
    if (redeem_script.empty() && !sigdata.redeem_script.empty()) {
        redeem_script = sigdata.redeem_script;
    }
    if (witness_script.empty() && !sigdata.witness_script.empty()) {
        witness_script = sigdata.witness_script;
    }
    signatures.insert(std::make_move_iterator(sigdata.signatures.begin()), std::make_move_iterator(sigdata.signatures.end()));
}

bool SignSignature(const SigningProvider &provider, const CScript& fromPubKey, CMutableTransaction& txTo, unsigned int nIn, const CAmount& amount, int nHashType)
{
    assert(nIn < txTo.vin.size());

    MutableTransactionSignatureCreator creator(&txTo, nIn, amount, nHashType);

    SignatureData sigdata;
    bool ret = ProduceSignature(provider, creator, fromPubKey, sigdata);
    UpdateInput(txTo.vin.at(nIn), sigdata);
    return ret;
}

bool SignSignature(const SigningProvider &provider, const CTransaction& txFrom, CMutableTransaction& txTo, unsigned int nIn, int nHashType)
{
    assert(nIn < txTo.vin.size());
    const CTxIn& txin = txTo.vin[nIn];
    assert(txin.prevout.n < txFrom.vout.size());
    const CTxOut& txout = txFrom.vout[txin.prevout.n];

    return SignSignature(provider, txout.scriptPubKey, txTo, nIn, txout.nValue, nHashType);
}

namespace {
/** Dummy signature checker which accepts all signatures. */
class DummySignatureChecker final : public BaseSignatureChecker
{
public:
    DummySignatureChecker() {}
    bool CheckECDSASignature(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const override { return true; }
    bool CheckSchnorrSignature(Span<const unsigned char> sig, Span<const unsigned char> pubkey, SigVersion sigversion, ScriptExecutionData& execdata, ScriptError* serror) const override { return true; }
};
const DummySignatureChecker DUMMY_CHECKER;

class DummySignatureCreator final : public BaseSignatureCreator {
private:
    char m_r_len = 32;
    char m_s_len = 32;
public:
    DummySignatureCreator(char r_len, char s_len) : m_r_len(r_len), m_s_len(s_len) {}
    const BaseSignatureChecker& Checker() const override { return DUMMY_CHECKER; }
    bool CreateSig(const SigningProvider& provider, std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode, SigVersion sigversion) const override
    {
        // Create a dummy signature that is a valid DER-encoding
        vchSig.assign(m_r_len + m_s_len + 7, '\000');
        vchSig[0] = 0x30;
        vchSig[1] = m_r_len + m_s_len + 4;
        vchSig[2] = 0x02;
        vchSig[3] = m_r_len;
        vchSig[4] = 0x01;
        vchSig[4 + m_r_len] = 0x02;
        vchSig[5 + m_r_len] = m_s_len;
        vchSig[6 + m_r_len] = 0x01;
        vchSig[6 + m_r_len + m_s_len] = SIGHASH_ALL;
        return true;
    }
    bool CreateSchnorrSig(const SigningProvider& provider, std::vector<unsigned char>& sig, const XOnlyPubKey& pubkey, const uint256* leaf_hash, const uint256* tweak, SigVersion sigversion) const override
    {
        sig.assign(64, '\000');
        return true;
    }
};

}

const BaseSignatureCreator& DUMMY_SIGNATURE_CREATOR = DummySignatureCreator(32, 32);
const BaseSignatureCreator& DUMMY_MAXIMUM_SIGNATURE_CREATOR = DummySignatureCreator(33, 32);

bool IsSolvable(const SigningProvider& provider, const CScript& script)
{
    // This check is to make sure that the script we created can actually be solved for and signed by us
    // if we were to have the private keys. This is just to make sure that the script is valid and that,
    // if found in a transaction, we would still accept and relay that transaction. In particular,
    // it will reject witness outputs that require signing with an uncompressed public key.
    SignatureData sigs;
    // Make sure that STANDARD_SCRIPT_VERIFY_FLAGS includes SCRIPT_VERIFY_WITNESS_PUBKEYTYPE, the most
    // important property this function is designed to test for.
    static_assert(STANDARD_SCRIPT_VERIFY_FLAGS & SCRIPT_VERIFY_WITNESS_PUBKEYTYPE, "IsSolvable requires standard script flags to include WITNESS_PUBKEYTYPE");
    if (ProduceSignature(provider, DUMMY_SIGNATURE_CREATOR, script, sigs)) {
        // VerifyScript check is just defensive, and should never fail.
        bool verified = VerifyScript(sigs.scriptSig, script, &sigs.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS, DUMMY_CHECKER);
        assert(verified);
        return true;
    }
    return false;
}

bool IsSegWitOutput(const SigningProvider& provider, const CScript& script)
{
    int version;
    valtype program;
    if (script.IsWitnessProgram(version, program)) return true;
    if (script.IsPayToScriptHash()) {
        std::vector<valtype> solutions;
        auto whichtype = Solver(script, solutions);
        if (whichtype == TxoutType::SCRIPTHASH) {
            auto h160 = uint160(solutions[0]);
            CScript subscript;
            if (provider.GetCScript(CScriptID{h160}, subscript)) {
                if (subscript.IsWitnessProgram(version, program)) return true;
            }
        }
    }
    return false;
}

bool SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore, const std::map<COutPoint, Coin>& coins, int nHashType, std::map<int, bilingual_str>& input_errors)
{
    bool fHashSingle = ((nHashType & ~SIGHASH_ANYONECANPAY) == SIGHASH_SINGLE);

    // Use CTransaction for the constant parts of the
    // transaction to avoid rehashing.
    const CTransaction txConst(mtx);

    PrecomputedTransactionData txdata;
    std::vector<CTxOut> spent_outputs;
    for (unsigned int i = 0; i < mtx.vin.size(); ++i) {
        CTxIn& txin = mtx.vin[i];
        auto coin = coins.find(txin.prevout);
        if (coin == coins.end() || coin->second.IsSpent()) {
            txdata.Init(txConst, /*spent_outputs=*/{}, /*force=*/true);
            break;
        } else {
            spent_outputs.emplace_back(coin->second.out.nValue, coin->second.out.scriptPubKey);
        }
    }
    if (spent_outputs.size() == mtx.vin.size()) {
        txdata.Init(txConst, std::move(spent_outputs), true);
    }

    // Sign what we can:
    for (unsigned int i = 0; i < mtx.vin.size(); ++i) {
        CTxIn& txin = mtx.vin[i];
        auto coin = coins.find(txin.prevout);
        if (coin == coins.end() || coin->second.IsSpent()) {
            input_errors[i] = _("Input not found or already spent");
            continue;
        }
        const CScript& prevPubKey = coin->second.out.scriptPubKey;
        const CAmount& amount = coin->second.out.nValue;

        SignatureData sigdata = DataFromTransaction(mtx, i, coin->second.out);
        // Only sign SIGHASH_SINGLE if there's a corresponding output:
        if (!fHashSingle || (i < mtx.vout.size())) {
            ProduceSignature(*keystore, MutableTransactionSignatureCreator(&mtx, i, amount, &txdata, nHashType), prevPubKey, sigdata);
        }

        UpdateInput(txin, sigdata);

        // amount must be specified for valid segwit signature
        if (amount == MAX_MONEY && !txin.scriptWitness.IsNull()) {
            input_errors[i] = _("Missing amount");
            continue;
        }

        ScriptError serror = SCRIPT_ERR_OK;
        if (!VerifyScript(txin.scriptSig, prevPubKey, &txin.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS, TransactionSignatureChecker(&txConst, i, amount, txdata, MissingDataBehavior::FAIL), &serror)) {
            if (serror == SCRIPT_ERR_INVALID_STACK_OPERATION) {
                // Unable to sign input and verification failed (possible attempt to partially sign).
                input_errors[i] = Untranslated("Unable to sign input, invalid stack size (possibly missing key)");
            } else if (serror == SCRIPT_ERR_SIG_NULLFAIL) {
                // Verification failed (possibly due to insufficient signatures).
                input_errors[i] = Untranslated("CHECK(MULTI)SIG failing with non-zero signature (possibly need more signatures)");
            } else {
                input_errors[i] = Untranslated(ScriptErrorString(serror));
            }
        } else {
            // If this input succeeds, make sure there is no error set for it
            input_errors.erase(i);
        }
    }
    return input_errors.empty();
}

redpajama_set_name: RedPajamaGithub


text:
Productivity Commission inquiry into NDIS costs
The National Disability Insurance Scheme (NDIS) is an extremely significant, complex and challenging reform. It has been a long journey to get to this point. Prolonged advocacy and community action from people with disability, families and advocates led to the Productivity Commission undertaking the Inquiry into Disability Care and Support. The Inquiry found that the disability service system was "underfunded, unfair, fragmented, and inefficient, and gives people with a disability little choice and no certainty of access to appropriate supports."[1] This led to the remodelling of the disability services system with the introduction of the NDIS.
The NDIS aims to clearly define disability services and support provision in the context of affording the rights of people with disability. It represents a significant shift from the previous model of providing block funding to disability services to providing portable and individualised funding packages, with a focus on enabling people with disability to exercise choice and control in relation to supports received.[2]
The NDIS is currently transitioning from several trial sites across the country to full implementation by 2019. This will involve an increase in people receiving Individual Funding Packages from around 35 000 to 460 000 within a short timeframe of three years.[3] Experiences from the trial sites to date have also indicated that there are more people than expected entering the Scheme.[4] There is a real tension between meeting the immediate, sudden and increasing needs of people entering the Scheme and realising the intent of the NDIS. The direct experiences of transition reported to CYDA, as well as discussions in the community and media coverage of participant and service provider experiences indicate that the NDIS, in this early stage, is highly stressed.
Amid this frenetic activity within the Scheme there is a lack of transparency around the operations of the NDIS and this makes developing a clear understanding of the Scheme extremely challenging for people with disability, member organisations, service providers and the broader community. This creates uncertainty for stakeholders in terms of engaging with the NDIS and effectively informing its development.
To date, CYDA has received mixed feedback regarding the experiences of children and young people accessing the NDIS. While there have been positive experiences reported, CYDA has also heard of lengthy delays in planning and implementation of services and challenges in establishing quality NDIS plans for children and young people.
It is commonly reported by potential participants, other people with disability, families and the broader community that they have limited knowledge about the NDIS. Much of this relates to poor understandings about how the NDIS works, eligibility and which services can be accessed through the Scheme. There remains unrealistic expectations held by many in the community, who view the NDIS as the sole 'solution' to the significant barriers to meaningful participation and inclusion experienced by people with disability.
The complexity and size of the reform being undertaken, while much needed, is highly ambitious. It has involved a major philosophical shift in the principles and methods of service delivery; changes in roles, responsibilities and financing for jurisdictions; and also unique governance structures. A key driver of the establishment of this new system was the need to unravel the maze of disability services and supports which had been created in response to the crisis and service gaps. Many of the direct experiences of people with disability, including children and young people, highlight the real risk that we are developing a new kind of maze with the creation of the NDIS. The change from a funded sector to a 'market 'is bewildering to many people, as is coming to terms with dramatically different, but opaque language, expectations and processes.
CYDA is of the view that the NDIS has the capacity to be an absolute game changer in affording human rights and equal opportunities to children and young people with disability in Australia. It is therefore important that there is honest discourse and critical reflection as the NDIS continues to roll out so we can ensure participants and other stakeholders are not overwhelmed by complex and unnecessary bureaucratic processes and that the fundamental principles of the Scheme are allowed to come to life in everything it does.
This submission is informed by the direct experiences of children and young people with disability and their families. It responds to key topics of relevance included in the inquiry issues paper. While CYDA has sought to minimise repetition, certain issues are highlighted throughout as they impact on multiple areas of focus of this inquiry. Due to limitations in organisational capacity and the limited time available to provide submissions, CYDA was unable to provide a more comprehensive response to the Commission's issues paper.
Children and Young People with Disability Australia
CYDA is the national representative organisation for children and young people with disability, aged 0 to 25 years. The organisation is primarily funded through the Department of Social Services and is a not for profit organisation. CYDA has a national membership of 5300.
CYDA provides a link between the direct experiences of children and young people with disability to federal government and other key stakeholders. This link is essential for the creation of a true appreciation of the experiences and challenges faced by children and young people with disability.
CYDA's vision is that children and young people with disability living in Australia are afforded every opportunity to thrive, achieve their potential and that their rights and interests as individuals, members of a family and their community are met.
CYDA's purpose is to advocate systemically at the national level for the rights and interests of all children and young people with disability living in Australia and it undertakes the following to achieve its purpose:
Listen and respond to the voices and experiences of children and young people with disability;
Advocate for children and young people with disability for equal opportunities, participation and inclusion in the Australian community;
Educate national public policy makers and the broader community about the experiences of children and young people with disability;
Inform children and young people with disability, their families and care givers about their citizenship rights and entitlements; and
Celebrate the successes and achievements of children and young people with disability.
CYDA and the NDIS
CYDA has undertaken extensive work regarding the NDIS, including involvement in the community campaign to reform disability services and supports that led to the establishment of the Scheme. This work has involved ongoing and extensive consultation with CYDA members and constituents regarding experiences of the NDIS. Extensive advocacy to members of parliament, governments and other stakeholders has also occurred.
CYDA has provided a range of submissions in relation to the NDIS, including to the:
Productivity Commission Inquiry into Disability Care and Support (2010 and 2011);
Proposed Criteria for NDIS "Eligibility and Reasonable and Necessary Support" (2012);
NDIS Bill (2012 and 2013);
Policy Paper on the NDIS and Education Interface (2013);
Policy Paper on the NDIS and Family Support Program Interface (2013);
National Disability Insurance Agency (NDIA) Draft Strategic Plan (2014);
Framework for Information, Linkages and Capacity Building consultation (2015);
NDIS Quality and Safeguarding Framework consultation (2015);
Senate Inquiry into Violence, Abuse and Neglect Against People with Disability in Institutional and Residential Settings (2015);
Senate Inquiry into Education and Students with Disability (2015);
Independent Review of the Operation of the NDIS Act (2015);
Senate Inquiry into the NDIS Savings Fund Special Account Bill (2016);
Senate Inquiry into the Transition of the Mobility Allowance to the NDIS (2016); and
Joint Parliamentary Inquiry into the Provision of Hearing Services under the NDIS (2017).[5]
Participation in a range of related advisory committees for the NDIS has also occurred, including: the Victorian taskforce of the Every Australian Counts campaign; Expert Advisory Group on Quality Standards and Safeguarding; NDIS Chief Executive Officer Forum; and the NDIS Practice Standards Technical Reference Group. CYDA has also presented to the NDIS Independent Advisory Council and has undertaken a range of work with the Department of Social Services in relation to the NDIS Quality and Safeguarding Framework.
CYDA has participated in a range of public consultations and events, including: consultation on the drafting of the NDIS legislation and rules; developing the Quality and Safeguarding Framework; Information, Linkages and Capacity Building frameworks; NDIS and advocacy conference; and NDIS website redevelopment. Finally, CYDA has presented to multiple public hearings about the NDIS, including to inquiries regarding the NDIS Bill (2013) and the NDIS Savings Fund Special account (2016).
CYDA has maintained a consistent dialogue with members about the NDIS, consistently seeking feedback about the member experiences and concerns. CYDA undertook a specific consultation in relation to this inquiry, through a survey of young people with disability and families of children with disability. CYDA received 161 responses to the survey which was conducted over an 11 day period in March 2017.
Consistent with earlier feedback to CYDA in relation to the NDIS, the responses to the survey were highly variable. In CYDA's survey, approximately one third of experiences reported were positive. Positive aspects reported include:
Access to useful information about the NDIS from community organisations and networks;
Positive experiences of planning due to skills of individual planners and Local Area Coordinators (LACs);
Opportunity to self-manage; and
Better outcomes and access to services in comparison to previous system.
The majority of responses from young people and families have reported negative experiences of the NDIS. These include:
Limited information provision about the NDIS and poor communication from the NDIA;
Extremely limited understanding about how services and supports can be accessed for those who are ineligible for the NDIS;
Significant variability in experiences of the planning process and expertise of planners;
Delays in establishing plans and accessing services;
Difficulties in changing an approved plan;
Limited information and understanding about complaint and review processes; and
Concerns the NDIS is not achieving its stated objectives.
Examples of direct experiences reported to CYDA include:
I have heard so many bad things about the NDIS, (my child) won't be accessing it.
(The eligibility criteria is) not clear at all…I think that my son will be eligible because we had services from the state disability sector but no one has told us.
(The NDIS application process is) very confusing. I could not have (navigated) it without specialist help.
Our application got lost. The plan was done over the phone and doesn't in fact represent our current situation or needs at all.
Applying for the NDIS was reasonably simple. However, it was a long process – approximately six months between the initial phone call and approved plan. There were numerous phone calls/interviews and no real transparency as to where we were in the process and what the next steps were.
The 1800 number is difficult to contact but I have a direct line of contact to our son's planner. She has been instrumental in our very successful plan along with our son's coordinator of supports. Without these two people our son would be VERY disadvantaged.
I feel like I don't know all that I can ask for from the NDIS. Am I doing a disservice to my son because I am not able to get him everything he needs?
Planners have been very friendly and supportive but for more recent plans they have used standardised questions which are not easily applicable to children.
Our current planner is fantastic but our first planner had very limited knowledge of our son's needs and proposed a minimal plan that was far from what we needed.
The first planner was skilled, friendly and available. The second less accommodating and totally unprepared…This was inefficient and resulted in a protracted process.
As far as I'm aware, the planner had no skills in relation to working with or understanding people with disability. They could not provide any guidance or advice and seemed to be simply a 'note taker.'
If the planner had listened to me in the first place I wouldn't be having to go through disability advocacy to get the right type of supports for my son and experience the red tape, frustration, anger and time consuming processes that I have been going through.
While accessing therapy has been ok, there are waiting lists, which are sometimes long. I'm still confused about what I can use the core funding for and the NDIS have given me conflicting answers.
The terminology used by NDIS is mind boggling.
My daughter now has better opportunities than what was available before the NDIS.
In the past three years, the NDIS has been a godsend. My son has gone from a child who didn't want to live anymore to a young teen who has a future. Their funding for our service provider has changed our lives… (But now) I am not getting the efficient assistance we have had in the past. Something that they previously did in two weeks is now going on for four weeks with no sign of it being sorted soon.
My life has been significantly improved by the support I receive through the NDIS. Before I was on the NDIS I was receiving hardly any support and the support I was receiving wasn't great. My support workers wouldn't show up or shifts would be cancelled and the service provider wouldn't notify me.
The rhetoric (of the NDIS) is wonderful, however, the reality has been somewhat different.
In some ways (the NDIS is facilitating social and economic participation) but the public still looks at (our family) like we have the plague so participating is still uncomfortable.
I feel lucky that I'm confident enough to self-manage my plan as that has given me a lot of freedom about the service providers and supports I choose.
Key Issues Identified in the discussion paper
Discussed below are key issues in relation to the development of the NDIS that CYDA believes impact participant outcomes and Scheme costs. The responses are framed in response to the topic areas contained in the issues paper for this inquiry. A key theme that runs throughout is the complexity of the NDIS as it has developed. This creates significant challenges in engaging with the Scheme for people with disability and families, as well as other stakeholders. While in many cases, the complexity of the NDIS has occurred as a result of transitional or administrative issues, there are flaws in the Scheme design that are also contributing to the difficulties being experienced. It is important that clear systemic actions are taken to address problems so they do not become structural weaknesses embedded in the NDIS that undermine the effectiveness of the achievement of its objectives. On many levels Australia needs the NDIS to succeed.
Scheme costs
This section highlights factors that CYDA views as potential 'cost-drivers' and risks to the NDIS that should be considered in light of the current inquiry.
Progress under the National Disability Strategy
It is important to situate the NDIS within the broader context of reform to ensure the rights of people with disability are afforded in Australia, particularly the National Disability Strategy 2010-2020. The implementation of the National Disability Strategy is a critical determinant of the level of success achieved in the NDIS.
The National Disability Strategy is a major policy framework to guide reform of policy and programs critical to the lives of people with disability. It sets a 10-year plan to address the barriers faced by Australians with disability across a range of life areas. The purpose of the Strategy is to:
Establish a high level policy framework to give coherence to, and guide government activity across mainstream and disability-specific areas of public policy;
Drive improved performance of mainstream services in delivering outcomes for people with disability;
Give visibility to disability issues and ensure they are included in the development and implementation of all public policy that impacts on people with disability; and
Provide national leadership toward greater inclusion of people with disability.[6]
Six main policy outcomes are covered by the Strategy. Identified under each of these outcomes are specific areas for future action and policy. [7]
Inclusive and accessible communities;
Rights protection, justice and legislation;
Economic security;
Personal and community support;
Learning and skills; and
Health and wellbeing.
The Strategy was developed by local, state, territory and Commonwealth governments under the auspices of the Council of Australian Governments (COAG). In doing so, a key aim was to ensure a cohesive approach between governments and the broader community is undertaken in relation to the goals and areas of policy action identified.[8] Each level of government has roles and responsibilities under the Strategy and a series of implementation plans are being utilised to support implementation.[9] The second implementation plan, entitled Driving Action 2015-2018, was recently released.
The Strategy is a significant framework to ensure the rights of people with disability are afforded across all life areas in Australia. Providing quality services and supports to people with disability is only one focus area within the Strategy. Despite this, the NDIS has consistently dominated policy considerations and community discussions regarding much needed disability reform.
CYDA is concerned that there frequently appears to be an assumption that the NDIS will comprehensively address all barriers to participation and inclusion of people with disability. As a consequence disability services and supports remain extensively siloed and not embedded in a broader context of inclusive mainstream services and communities.
To date there has been limited progress in meeting the aims of the Strategy with mainstream sectors typically not embracing the required cultural shift and associated specific reform to support the inclusion of people with disability.
A lack of clear processes and accountability for implementing the Strategy, minimal resourcing and investment and a weak outcomes framework has left this vital reform languishing. A consequence of this is that attitudinal change has been limited within the Australian community. This contributes to a common view that the NDIS is simply a way of 'helping' people with disability which is contextualised in a 'pity' framework rather than a rights based context.
The recent political debates about whether the Australian community can afford the NDIS have unfortunately fed into this view, by giving voice to the outdated notion of people with disability being 'burdensome,' that the Strategy and the NDIS are intended to replace with genuine inclusion.
The impetus for changing culture and attitudes about disability in Australia needs to occur outside the disability sector, not just within it. There is a key map for driving this attitudinal and behavioural change in the Strategy. However, unless the Strategy is embraced and recognised there is a high chance that reform will be limited to a bigger and more efficient service system and we will not witness the cultural change which is imperative for affording the rights of people with disability.
There is a real need for re-invigoration of the National Disability Strategy to ensure it becomes a lived reality. The present implementation plan has a key focus area on increasing the knowledge and awareness of the Strategy. This needs to be accompanied by a rigorous outcomes framework which clearly defines roles, responsibilities, measures, timelines and evaluation.
In addition, there is an urgent need to develop mechanisms to ensure stronger monitoring of progress under the Strategy by governments. We are seven years into a ten year strategy and the bulk of the reform is yet to materialise. CYDA recommends inclusion of the National Disability Strategy as an agenda item at each meeting of COAG and each COAG council. This should also include consideration of interface issues between the NDIS and mainstream sectors.
Recommendation 1: Development of a rigorous work plan and outcomes framework for the implementation of the National Disability Strategy 2010-2020 which includes clearly defined roles, responsibilities, measures, timelines and evaluation.
Recommendation 2: The National Disability Strategy 2010-2020 and progress in meeting associated outcomes is a standard agenda item in COAG meetings, including the responsible COAG councils.
Systemic Failings in Education
The Australian education system is currently failing to adequately meet the needs of students with disability. Parallel reform is urgently needed or the current crisis in education will greatly undermine the success of the NDIS. Not only will present barriers to education contribute substantial costs to NDIS participants who are currently school aged but they will have a significant impact on the opportunities and abilities for young people with disability to have increased social and economic participation throughout their post school lives.
Students with disability typically contend with profound barriers and disadvantage within the Australian education system. Direct experiences reported to CYDA and available statistics demonstrate that poor and compromised education experiences are currently the norm for students with disability. A typical education experience for students with disability involves discrimination, limited or no funding for support, inadequately trained staff, and a systemic culture of low expectations, exclusion and bullying. Disturbingly there are also increasing incidents of restraint and seclusion of students with disability reported to CYDA.
Poor education experiences and outcomes of students with disability are reflected in available Australian statistics:
45.8% of people aged 15 to 64 years with disability's highest level of education was Year 10 or below, compared to 25.7% of people without disability;[10]
41% of people with disability have completed Year 12, compared to 62.8% of people without disability;[11]
17% of people with disability have completed a Bachelor Degree or higher compared to 30.1% of people without disability;[12]
38% of young people aged 15 to 24 years with disability either work, study, or do a combination of both on a full time basis compared to 56% of young people without disability;[13]
The labour force participation rate for people with disability is 53.4% compared to 83.2% for people without disability;[14] and
People with disability experience higher rates of poverty than the total population (17.8% and 12.9% respectively).[15]
In recent years there have been initiatives that have contributed to a greater understanding of the needs and experiences of students with disability and modest investments in reform. Key examples include: the Review of Funding for Schooling; More Support for Students with Disability; National Partnerships; the Nationally Consistent Collection of Data on Students with Disability; and school funding reform. However, although this broad review and tepid reform is progressing, the direct experience of students with disability continues to be overwhelmingly poor.
The impact of inadequate education provision on the life outcomes for these children and young people is profound. CYDA is concerned that the present education system is not providing students with disability with the necessary knowledge, skills and resources to support future meaningful social, community and economic participation.
CYDA has undertaken a significant body of work and advocacy in relation to education and students with disability and has made many recommendations to government and key stakeholders in this area.[16] In particular, CYDA has strongly advocated for a national plan for education reform and students with disability.[17] This should include clearly articulated aims, objects and measureable outcomes. Further, it needs to be grounded in a firm evidence base to provide a blueprint for embedded and systemic reform. A national plan should ensure that equal rights to an inclusive education are afforded to every student with disability.
It is also vital that there is explicit consideration of the linkages between education reform for students with disability and the developing NDIS. The interface of the education systems and the NDIS, as well as the integration of the two reform programs must therefore be a regular agenda item at COAG Education Council meetings.
CYDA would also like to highlight that despite the stated wish that the NDIS be nationally consistent, it will not be possible at present to achieve national consistency in the NDIS education interface because each state, territory and independent education system is different. Strong collaboration between jurisdictions and between the education and disability sectors will be required to address this.
In summary, without parallel reform in education, the aim of the NDIS to support social and economic participation of people with disability will be greatly diminished. It is therefore critical that systemic failures in education are seen as a major cost driver and risk for the NDIS. This must be a key consideration in the Productivity Commission's findings and urgently needed education reform must be prioritised by state and Commonwealth governments. These governments are co-owners of the NDIS and the costs of failures in education will be visible in the NDIS and will be borne by the same governments.
Recommendation 3: Development of a national plan for education reform and students with disability backed by strong political leadership regarding the implementation of the plan.
Recommendation 4: Inclusion of the education and NDIS interface as a regular agenda item at all COAG Education Council meetings.
Recommendation 5: Further refinement of strategies and actions to define and establish the education and NDIS interface. This needs to incorporate a mapping and future plan of relevant collaborative action and structures of relevant parties which include the NDIA, state, territory and Commonwealth governments, education authorities and relevant stakeholders including CYDA.
Recommendation 6: The development of a clear mechanism which ensures the direct experience of students with disability informs the establishment and ongoing work regarding the NDIS and education interface. This should include ongoing consultation with CYDA.
Participant Entry Rates
The Productivity Commission issues paper notes that there has been more children than expected accessing the NDIS, particularly in South Australia, Victoria and the Australian Capital Territory.[18] There has also been extensive reporting of this issue, particularly in relation to children with autism.[19] Further, there have been calls to consider changes to the eligibility criteria for the NDIS in light of high participant entry rates.[20]
It is important to consider issues in relation to eligibility in light of the insurance principles that underpin the NDIS. The NDIA's 2015-2019 Corporate Plan states the NDIS is based on four insurance principles:
Actuarial estimate of long-term costs, based on the "emerging experience of utilisation and cost";
Long-term view of funding requirements, with a focus on "lifetime value for scheme participants, and will seek to maximise opportunities for independence, and social and economic participation, with the most cost-effective allocation of resources";
Investment in research, innovation and outcome analysis; and
Investment in community participation and building social capital, including "encouraging the use of mainstream services to increase social and economic participation of people with disability."[21]
In particular, these principles seek to provide early intervention and support to people who access the NDIS to support future social and economic participation. Conversely, the NDIS has been developed based on an understanding that not providing reasonable and necessary supports to people with disability is a violation of a range of human rights and would result in extremely poor outcomes for individuals. Further, inadequate disability services provision would contribute to increased costs for other services, particularly in a crisis context, such as in health, justice, homelessness, child protection or others.
The present focus on containing NDIS costs by limiting eligibility therefore does not reflect these insurance principles as supports denied to people who are no longer eligible will reappear elsewhere and the community and economy will not have the benefit of people's participation. A focus on ensuring that decisions around reasonable and necessary supports for people and how these can maximise the participation and potential of people with disability is therefore more pertinent to the issue of NDIS costs.
Scheme boundaries
Eligibility for the NDIS as articulated in the NDIS Act 2013 (Cth) includes the following under 'disability requirements:'
The impairment or impairments result in substantially reduced functional capacity to undertake, or psychosocial functioning in undertaking, one or more of the following activities:
Communication;
Social interaction;
Learning;
Mobility;
Self-care;
Self-management.[22]
The approach of providing services and supports on the basis of the functional impact of disability on a person's life represents a significant shift from previous state and territory service systems, which typically had rigid eligibility criteria based on diagnostic information and assessments. Using a 'functional' approach recognises that disability impacts each person differently and considers support needs on a personal level.
Despite the definition of 'disability requirements' included in the NDIS Act, it has been reported to CYDA that eligibility assessment processes for the NDIS do not always include due consideration of the functional impact of a child or young person's disability. In some cases there appears to be a stronger reliance on diagnostic information and assessments in determining eligibility, rather than through developing an understanding of the specific person and their individual needs and circumstances.
The following concerns have been raised to CYDA by members and constituents:
I was originally told you didn't need a diagnosis but have since heard you do need those doctors' reports. This makes it hard to get funding for those children that need speech therapy or hearing assessments when doctors are still unsure of their diagnosis.
The criteria does not seem needs or function based.
Eligibility criteria (seems) written around easily defined physical and chromosomal conditions. Its suitability for those with psychosocial conditions is poor, leaving this cohort at a distinct disadvantage, particularly as staff are not trained in this area.
In addition, the 'Access Request Form' requires provision of supporting information about the person's disability, including the option of having a health or education professional to complete a table assessing the person's needs in a range of areas. CYDA is particularly concerned about education professionals providing this information.
It has been well established that education professionals have minimal training and expertise in relation to meeting the learning needs of students with disability and this is a key contributor to poor outcomes and barriers typically experienced by these students. This was most recently reflected in the final report of the Senate inquiry into Current Levels of Access and Attainment for Students with Disability in the School System, and the Impact on Students and Families Associated with Inadequate Levels of Support.
A key finding of this inquiry was that "too many teachers were inadequately aware of issues surrounding the education of students with disability, including the rights of students to an education and the necessity of additional adjustments and support for some students."[23] This issue has also been raised by the Australian Education Union, whose 2015 survey found that 63% of teachers reported the level of training and professional development they had undertaken has not provided them with the skills and knowledge to teach students with disability.[24]
Additionally some of the information required would not be under the purview of an education provider. They are educators first and foremost and few have the clinical expertise to provide comment or assessment on the information requested in the Access Request Form. For example the Form asks for information about whether the applicant requires home modifications to support mobility or support with personal care such as showering and toileting.
It is therefore the strong view of CYDA that educational professionals should not be able to assess the support needs of children and young people with disability to inform eligibility decisions or at a minimum should be required to provide evidence of their specific expertise which equips them to undertake this role.
Recommendation 7: Removal of the option for education professionals to provide information about the support needs of students with disability to inform eligibility assessments unless evidence of specific expertise to make these assessments can be provided.
Interfaces with Mainstream Services
As acknowledged in the issues paper for this inquiry, the intersection of the NDIS with mainstream services is critical to meeting the needs of participants and ensuring the sustainability of Scheme costs.[25] Further, poorly defined interfaces risk leading to service gaps and cost-shifting.[26] Since the NDIS's inception, CYDA has frequently highlighted the need to clearly develop interface arrangements with mainstream sectors, particularly education. However, NDIS interface arrangements are not well advanced in 2017 and although their importance has been noted since the inception of the NDIS in 2013, they have not been a strategic priority for the Scheme or the Disability Reform Council.
Children, young people and families typically access a broad range of services and supports, including those provided by early childhood and school education; family and children's services; health; employment; and more. These various systems are fundamental to our community and support the development of children. Many of these areas, as outlined previously in this submission, have significant barriers and gaps that work against the inclusion of children and young people with disability.
The articulation of the NDIS interface with these other life areas and associated service systems is critical to the success of the Scheme. On its own, the NDIS cannot fill the gaps resulting from barriers and inadequacies of other service areas. Rather, there needs to be a negotiated interface which reinforces that affording rights and inclusion of people with disability is everyone's business, not just something that can be passed off to the disability portfolio, as has been the case in the system we are trying to leave behind. This also reaffirms the importance of the National Disability Strategy, which provides the framework and map for meeting obligations and rights to people with disability across the community.
Key issues raised to CYDA by members in regard to this area have included the visible lack of continuity and coordination between the NDIS and mainstream services, with some reporting a 'total disconnection.' Some have said that they feel as though they have to take some responsibility for connecting services and systems, which is a totally unrealistic expectation and no substitute for rigorous public policy development. Others stated that interface arrangements are ad hoc and extremely unclear. 80% of CYDA NDIS survey respondents reported that it is currently unclear what the NDIS funds in regard to other systems in the child or young person's life and how this is coordinated. Experiences reported to CYDA are provided below:
There is not a good understanding at the NDIA about the importance of continuity - there is an 'us and them' attitude with respect to education and health.
(Interface arrangements are) clear as mud. All involved seemed to be making it up as they go.
(The NDIA has) no idea of the role of schools. The planner suggested the school would give my child physiotherapy sessions.
Sometimes it seems like the boundaries keep moving.
It is not clear what NDIS will fund in regard to assistance during school hours and what will be funded by the education department.
The operation of the NDIS and the practicalities of the interfaces with mainstream programs will be complex and dynamic. Clear protocols will be needed between portfolios and funding agencies and effective coordination at the community level will be required as the NDIS is implemented. This will also involve defining clear roles and lines of responsibility, funding arrangements, present gaps in service provision and ensuring effective collaboration occurs.
While CYDA understands that a range of work around mainstream interfaces with the NDIS is occurring at different levels of government and community, the approach taken to date appears patchy, uncoordinated and far from resulting in better integrated services. Much of what CYDA hears is that a degree of this work is aimed at resolving the one dimensional question of 'who pays for what', rather than seeking to break down program silos to provide better government responses. There is a need to map out the interface issues, the current work that is occurring and, the roles of key relevant stakeholders to ensure that a clear, coordinated and comprehensive strategy is developed regarding the NDIS interface with other service systems.
Recommendation 8: Work is undertaken to map the interfaces between the NDIS and mainstream areas, define relevant actions and roles of key stakeholders, including community sector peak bodies. This should inform the development of a clear, coordinated and comprehensive strategy around the development of NDIS interface areas.
Information, Linkages and Capacity Building
The Productivity Commission inquiry report into Disability Care and Support identified three 'tiers' of people impacted by a potential NDIS. Tier two was defined as "people with, or affected by disability" who "could approach the scheme for information and referral services (as distinct from funded support)."[27] This component of the NDIS is now referred to as Information, Linkages and Capacity Building (ILC).
The ILC appears to have been an afterthought in the Scheme design and as it is currently conceived it will be of relevance to the largest number of people with disability, with it being potentially accessed by the 2.5 million people under the age of 65 known to have a disability.[28] ILC therefore needs to incorporate a flexible process for accessing services and supports for people with disability and families, including mainstream services. CYDA understands that ILC services are in the early stages of implementation and is expected to be fully implemented in 2019-2020 when it will attract annual funding of $132 million, excluding funding for LAC.[29]
CYDA has some concerns about the development of the ILC component of the NDIS to date, particularly around the way the ILC policy defines the role of the NDIS. One of the stated aims of ILC is to "promote collaboration and partnership with local communities and mainstream and universal services to create greater inclusivity and accessibility of people with disability."[30] However, it is important to ensure the NDIA is not the key organisation that promotes and drives inclusion of people with disability in all areas of the community. It is important for mainstream sectors and the broader community to take the lead in this change, as articulated in the National Disability Strategy. Through ILC, the NDIS may facilitate opportunities and partnerships but should not be the 'director' of all things disability.
As an insurance scheme, it is inconceivable that the NDIS over time will not prioritise the ILC as a risk management tool to reduce cost pressures on individual packages. This is not the purpose of 'tier 2' of the original model. It was always more to do with genuine community connection and a support infrastructure that formed a critical part of the overall response to supporting people with disability. It cannot be allowed to be seen as being subordinate to the core funding business of the NDIS.
An issue that emerged in CYDA's survey is that 68% of respondents are not aware of how to access services and supports if the child or young person is not eligible for the NDIS. Respondents also raised concerns that many state and territory funded services are withdrawing as a result of the NDIS. Relevant feedback included the following:
I am very worried about what will happen for kids with mild to moderate (disability), where will they access services?
There is very little available without NDIS funds. Community and state based services are all disappearing.
I only know how to access services privately such as occupational or speech therapy.
Access to services for young children are being withdrawn in New South Wales as the NDIS rolls out…Only services appear to be those provided by (the health department).
There really is no help if you are ineligible.
These experiences reflect the need for clear pathways to access services and supports for children and young people who are not eligible for the NDIS. However, in CYDA's understanding there currently appears to be a gap in service provision between the Individual Funding Package and ILC components of the Scheme that will impact a large group of people, namely people who are not eligible for the NDIS but who require periodic disability services and supports.
The following is a hypothetical yet common scenario:
Sam is 18 years old and has recently commenced a university degree. Sam requires support in some areas due to the functional impact of his disability but doesn't need or want an Individual Funding Package through the NDIS. He has previously accessed different supports and therapies at different stages throughout his childhood. Sam will require periodic support and services, including some allied health services. When this will be required will be variable according to circumstances and events in his life.
A key area where Sam currently requires additional support is in applying for employment. He is ineligible for existing disability employment support. A useful option given Sam's circumstances would be accessing mainstream services in conjunction with his existing therapists so support can be tailored to meet his particular needs and circumstances.
Sam still needs funding to pay for his variable needs for services and supports which are directly related to the functional impact of his disability.
In the scenario above, it appears the young person would have to pay privately which is not an option for many. Alternatively, support may be accessed through community systems. However, this may preclude people from accessing a favoured service or professional who has an extensive knowledge, expertise and relationship with the young person concerned.
Further, this scenario highlights some of the challenges in terms of practicalities encountered by people who are not eligible for the NDIS. It is presently unclear how the types of services described above will be provided and funded, as they are not included within the five activity streams under ILC. Further, split between 2.5 million people with disability, the allocated funds for ILC would not be sufficient to provide these services. This issue therefore requires explicit consideration. Options that can be considered include block funding some services or providing shorter term funding that can be used as needed.
Recommendation 9: Review of structure and funding of the ILC be undertaken.
Recommendation 10: Consideration of how service provision will be funded and accessed for people who are not eligible for the NDIS, given the current parameters around ILC funded activities.
Age considerations
It is absolutely paramount that there is adequate understanding and recognition of the specific considerations for children within the NDIS. First and foremost it's important that children with disability are defined and responded to as children first in the context of the Scheme.
Australia is a signatory to the United Nations Convention on the Rights of the Child. This human rights instrument clearly articulates the obligations of States Parties to ensure children with disability are afforded their right to childhood and inclusion in their community on an equal basis to their peers without disability.[31] The Convention details the rights of children in a range of life areas, including the right to: protection and care; live with and be cared for by family; express their views; health; social security and an adequate standard of living; education; play; and to be free from abuse.[32] The Convention also states that consideration of a child's best interests must guide all decisions impacting children.[33]
Despite this strong human rights framework, in Australia the present experience of childhood is typically very different for children with disability. Many of the activities and opportunities which are typically part of the active citizenship and participation of a child are frequently denied to children with disability. Examples include being able to play at a local playground, attending a local school or attend a friend's birthday party.
It is envisaged that the NDIS will play a significant role in changing this current reality for children with disability. This will occur by facilitating and supporting childhood development through timely and adequate early intervention and accessing appropriate services and supports to enable equal opportunities and participation throughout childhood. In addition, implementation of the National Disability Strategy and the NDIS will ultimately contribute to the development of inclusive communities.
Available evidence suggests almost all children with disability live with their families.[34] It is therefore critical that the context of children in families frames the delivery of services and supports. This means services must be 'wrapped around' the child and their family. Further, it is essential that developmental considerations are applied in all aspects of the NDIS where children are considered, including in eligibility, planning and service provision. As it is designed, there is not adequate recognition of the different context for children. The planning and funding mechanisms are virtually the same as they are for adults in the Scheme.
Also important is that Scheme operations are reflective of the specific protective needs of children with disability. Available Australian and international evidence indicates that children and young people with disability are over three times more vulnerable to experiencing abuse and neglect than their peers without disability. [35] CYDA is frequently informed of experiences of abuse and neglect of children with disability. This include incidents that are clearly defined and understood as abuse. Also of significant concern are the number of experiences that are not recognised as abuse by many when a child disability is involved. Examples include a child being restrained to 'manage behaviour' or a student being denied food, drink and toilet trips during long bus trips to and from school.
These specific protective and safeguarding needs of children with disability must be embedded in all aspects of the NDIS. Of key importance is the NDIS Quality and Safeguarding Framework, however this document contains minimal specific reference to children. The Royal Commission into Institutional Responses to Child Sexual Abuse has highlighted the need for child-specific safeguards and standards to prevent abuse in institutional contexts. However to date it is unclear how the significant body of work of the Royal Commission and the findings to be released in December 2017 will inform the NDIS and its approach to working with children.
Protective considerations and safeguards must also be at the core of the NDIS systems and processes as they relate to children, including planning. It is currently unclear what risk assessment tool is being used for children's plans and how considerations around safeguarding are incorporated. Information about the tool being used is not publically available and CYDA has repeatedly requested access to this document which has not been provided to date.
NDIS planning for children needs to be informed by an evidenced-based safeguarding framework. It is critical that work is undertaken to examine how available evidence around safeguarding children with disability can be applied to planning processes. In 2012 CYDA released an issues paper entitled Enabling and Protecting: Proactive Approaches to Addressing the Abuse and Neglect of Children and Young People with Disability.[36] This paper provides a detailed discussion of the causes, experience and responses to abuse of children and young people with disability, much of which is relevant to NDIS planning. For example, it highlights a range of factors that increase the risk of abuse of children with disability, including negative attitudes about disability and organisational cultures that devalue children with disability.[37] It is vital there is an understanding of these factors embedded in planning.
Additionally, despite there being vastly different considerations for children and adults in the development and provision of disability services and supports, there are no specific principles that guide the way the Scheme works with children and families. For example, there are no specific principles included in the 'children' section of the NDIS Act. Legislative change to more clearly define principles for working with children could provide an opportunity to embed developmental and protective considerations in all aspects of the NDIS as it relates to children.
Recommendation 11: Amendment of the NDIS Act to include specific principles that guide the way the NDIS applies to children. This should include ensuring that developmental and protective considerations are applied at all levels of the NDIS, including eligibility, planning and service delivery.
Recommendation 12: Considerations of how findings of the Royal Commission into Institutional Responses to Child Sexual Abuse will inform safeguards embedded in the NDIS.
Early Childhood Early Intervention
The NDIS Early Childhood Early Intervention (ECEI) approach for children aged 0 to 6 aims to "ensure that parents or primary caregivers are able to provide young children who have developmental delay or disabilities with experiences and opportunities that help children gain and use the functional skills they need to participate meaningfully in their environment."[38] The approach has three key stated features that guide the provision of ECEI, namely: capacity building for children and families; a family centred approach; and provision of support in "everyday environments."
A key component of the ECEI approach is the 'ECEI Partners.' These are designated to be a "first contact point for families" who provide information about appropriate supports for the child and make referrals.[39] ECEI Partners have been contracted alongside community organisations providing LAC services in some rollout regions. It is CYDA's understanding that in some jurisdictions, it is still to be identified who will undertake this 'partner' function so it is not an operational role of the NDIS in those areas.
The ECEI Partners are intended to be organisations with strong local knowledge and expertise around early intervention.[40] However concerns have been raised with CYDA that in some jurisdictions appointed ECEI Partners don't have local knowledge or the expertise which is stipulated for organisations undertaking this role. It is also understood that like the LAC partners in some regions, ECEI partners, where required, are having and will have an ongoing planning role for children. Further concerns reported to CYDA about these arrangements are that limited time is made available for these ECEI partners to develop an understanding of the child and family in going about their role.
We note that Noah's Ark have outlined these points in detail in their submission to this inquiry and additionally have raised issues in relation to the clarity of the ECEI approach taken by the NDIS. CYDA is of the view that the issues raised by Noah's Ark accurately reflect critical areas of future discussion and consideration and recommend these points to the Commission. CYDA would appreciate the opportunity to meet with the Commission to further discuss the issues raised around ECEI.
Key Considerations for Young People
It is also important that NDIS processes include adequate consideration of the specific circumstances of young people. Young people often experience a context of increasing independence, consideration of potential future life directions and rapid changes in a range of life areas. Researchers have theorised and conceptualised this time of life in different ways. One key example is the concept of "emerging adulthoods," recognising this time as crucial for developing identity and considering future life possibilities, while still requiring support in certain areas.[41]
The experiences and needs of young people with disability will vary significantly depending on individual circumstances. In many cases young people with disability will require different types of support and protective considerations. This will be impacted by a range of factors, one of which is the functional impact of disability. Many of these issues are discussed in a document developed by the NDIS Independent Advisory Committee (IAC) entitled Promoting Independence for People with Disability.[42]
Despite the issues highlighted by IAC, it is currently unclear how principles and evidence around the specific context of youth and meaningful participation are informing the approach of the NDIS to working with young people. It is crucial that available evidence, theoretical frameworks and the individual circumstances of young people are considered in relation to the practical implementation of the NDIS, including eligibility, planning, information provision and more. Critically, the Scheme needs to ensure the views and experiences of young people are the central informant of planning for funded supports.
Further, the IAC advice around increasing independence of young people is focused on those aged 18 to 25. For young people aged under 18, particularly older adolescents, the considerations will differ significantly than for younger children. However, again it is unclear what principles guide the approach of the NDIS to working with these young people.
Recommendation 13: Consideration of mechanisms to ensure available evidence and theoretical frameworks guide the practical implementation of the NDIS as it relates to young people (including those aged under 18 years), including eligibility, planning and information provision.
Planning processes
Plan Establishment
Experiences of developing an NDIS plan for children and young people with disability reported to CYDA have been highly variable. In the transition phase of the NDIS, the 'My First Plan' approach is being used. For many, this approach involves using previously accessed services and supports to inform plans. Some positive experiences of planning have been reported to CYDA, however a range of concerns have also been reported, with some being extremely dissatisfied with the process. Key issues reported to CYDA in relation to plan establishment include:
Perception that young people and families must advocate strongly or 'work hard' to achieve a quality plan;
Variability in the skills of planners, with some having limited expertise and experience;
Limited understanding of the needs and circumstances of the child or young person and services and supports included in the plan reflecting this;
A rushed planning process and a lack of preparation by planners;
Some plans being done remotely by telephone and people actively discouraged from having face to face planning meetings; and
Final plans not reflecting what was discussed at the planning meeting.
Examples of experiences reported to CYDA include:
It was a very 'scripted' meeting. It felt like they said the same thing 100 times and I was not able to give any ideas about what would help us.
(The planner was) very 'green' and inexperienced…I didn't like being told what my son needed or didn't need in his plan by a virtual stranger that clearly had no idea about (my son's disability).
Our first planner was terrible. I feel these people have a very small understanding of disability…Our second planner was great and understood my daughters needs and we received a very good plan that I am happy with.
The planners have listened and seemed to understand the needs, however conversations had do not seem to be reflected in the final plan.
(The planner) was polite and efficient. I couldn't help thinking that a lack of understanding of how my son's disability really impacts his life would affect his recommendations.
(The planner) had no idea of a child's needs and was not a competent listener.
(The planning process) seemed easy but really felt I had no idea what I was going to get and when the plan came out it was totally unsuitable and included things like respite care which I had strongly said was not suitable and we were not comfortable with. Felt like a standard plan and no one really listened.
The phone conversation we had was not represented in the plan. When I got the plan it was like the lady hadn't been listening to me and just made something up. The budget allocations are all wrong for what we need. Not impressed at all.
Issues such as the hurried nature of planning or experience and expertise of planners have clearly been affected by the Scheme's current transitional phase and administrative capacity. While CYDA understands the significant pressures associated with a large number of people accessing the NDIS as it rolls out, it is unclear what strategies are being put in place to ensure these issues do not become entrenched.
For example, there is no information available about how a shift away from the 'My First Plan' approach will occur to ensure planning reflects the intent of the NDIS to provide supports based on individual needs and circumstances including the functional impact of disability. Further, there is a need to articulate how appropriate training and evaluation of planners will occur to ensure quality planning processes. It is critical that adequate flexibility exists around plan establishment and review so current practice in terms of planning does not become entrenched.
An additional concern of CYDA's relates to rigid planning requirements, particularly the requirement that a Participant Statement of Goals and Aspirations is developed. This is seen as not reflective of the reality of the lives of children, young people and families. For school age children, goals and aspirations may be related to ongoing health issues or educational attainment, which are not the primary role of the NDIS. The formal setting of goals is viewed by CYDA as a highly contrived and unnatural activity. CYDA did not support the inclusion of this requirement during the drafting of the original legislation and rules and there has been no evidence that this statement adds anything other than an intrusive administrative burden for young people and families.
For children and young people with disability, frequently circumstances are ever-changing and complex. Needs, circumstances and the impact of disability may change or are unclear at certain stage

redpajama_set_name: RedPajamaCommonCrawl


Complete the form below. We'll send a verification message to the email address you've provided. Activate your account by clicking the link in the verification message and then start your search.
Note: You will need to use your cell phone (receive text msg) to confirm all appointment bookings.


APRIL 20, 2016 -- Wednesday, April 20, marks six years since the blowout on the Deepwater Horizon oil rig in the Gulf of Mexico.
That terrible incident was the start of a three month-long oil spill of millions of gallons per day until the well was capped on July 15, 2010. The cleanup took years to complete, the natural resource damage assessment was just finalized this spring, and restoration activities will take decades to complete.
Many long-term research projects are underway, and we are still learning about the effects of the spill on the environmental and the coastal communities of the Gulf of Mexico.
On April 4, 2016, the court approved a settlement with BP for natural resource injuries stemming from the Deepwater Horizon oil spill. This settlement concludes the largest natural resource damage assessment ever undertaken.
It is safe to say that scientists will be publishing papers and results for decades. For many of the people involved, the Deepwater Horizon oil spill is considered THE SPILL, the same way the generation of scientists that worked on the Exxon Valdez spill in Alaska almost 30 years ago consider that event.
We even keep track of events in a rough vernacular based on those incidents: Post-Deepwater or Pre-OPA (the Oil Pollution Act, passed in 1990, the summer after the Exxon Valdez spill).
But while those spills generate most of the publicity, policy interest, and research, responders in NOAA, the U.S. Coast Guard, and other agencies know that spills are a routine occurrence. Since the Deepwater Horizon spill, NOAA's Office of Response and Restoration has responded to over 800 other incidents.
Most are ones that you've probably never heard of, but here are a few of the larger incidents since Deepwater Horizon.
Enbridge Pipeline Leak, Kalamazoo, Michigan: On July 25, 2010, while the nation was fixated on the spill in the Gulf of Mexico, an underground pipeline in Michigan also began gushing oil. More than 800,000 gallons of crude oil poured out of the leaking pipeline and flowed along 38 miles of the Kalamazoo River, one of the largest rivers in southern Michigan. The spill impacted over 1,560 acres of stream and river habitat as well as floodplain and upland areas, and reduced recreational and tribal uses of the river. A natural resource damage assessment was settled in 2015 that will result in multiple resource restoration projects along the Kalamazoo River.
Exxon Mobil pipeline rupture, Yellowstone River, Montana: On July 1, 2011, an ExxonMobil pipeline near Billings, Montana, ruptured, releasing an estimated 31,500 to 42,000 gallons of oil into the iconic river, which was at flood-stage level at the time of the spill. Oil spread downstream affecting sensitive habitats.
Paulsboro, New Jersey, rail accident and release: On November 30, 2012, a train transporting the chemical vinyl chloride derailed while crossing a bridge that collapsed over Mantua Creek, in Paulsboro, New Jersey, near Philadelphia. Four rail cars fell into the creek, breaching one tank and releasing approximately 23,000 gallons of vinyl chloride. A voluntary evacuation zone was established for the area, and nearby schools were ordered to immediately take shelter and seal off their buildings.
Molasses spill, Honolulu, Hawaii: On September 8, 2013, a faulty pipeline operated by Matson Shipping Company leaked 233,000 gallons (1,400 tons) of molasses into Hawaii's Honolulu Harbor. A large fish kill resulted.
Texas City "Y" collision, Galveston, Texas: On March 22, 2014, the 585 foot bulk carrier M/V Summer Wind collided with an oil tank barge, containing 924,000 gallons of fuel oil. The collision occurred at the intersection, or "Y," in Lower Galveston Bay, where three lanes of marine traffic converge: vessels from the Port of Texas City, the Houston Ship Channel, and the Gulf Intracoastal Waterway. The collision breached the hull of the tank barge, spilling about 168,000 gallons of fuel oil into the waterway. A natural resource damage assessment is underway, evaluating impacts to shoreline habitats, birds, bottlenose dolphins, and recreational uses.
Refugio State Beach pipeline rupture, California: On May 19, 2015, a 24-inch crude pipeline ruptured near Refugio State Beach in Santa Barbara County, California. Of the approximately 100,000 gallons of crude oil released, some was captured and some flowed into the Pacific Ocean. The spill raised many challenges. The spill occurred in an especially sensitive region of the coast, known for its incredible diversity of marine life and home to the Channel Islands National Marine Sanctuary. The Refugio spill site is also the site of one of the most historically significant spills in U.S. history. Just over 46 years ago, off the coast of Santa Barbara, a well blowout occurred, spilling as much as 4.2 million gallons of oil into the ocean. A natural resource damage assessment for the Refugio spill is underway, focusing on impacts to wildlife, habitat, and lost recreational uses.
Barge Apex 3508 collision, Columbus, Kentucky: On September 2, 2015, two tug boats collided on the Mississippi River near Columbus, Kentucky, spilling an estimated 120,500 gallons of heavy oil. The oil sank to the river bottom and had to be recovered by dredge.
Train derailment, West Virginia: On February 16, 2015, a CSX oil train derailed and caught fire in West Virginia near the confluence of Armstrong Creek and the Kanawha River. The train was hauling 3.1 million gallons of Bakken crude oil from North Dakota to a facility in Virginia. Of the 109 train cars, 27 of them derailed on the banks of the Kanawha River, but none of them entered the river. Much of the oil they were carrying was consumed in the fire, which affected 19 train cars, and an unknown amount of oil reached the icy creek and river.
Each year NOAA's Office of Response and Restoration is asked to respond to an average of 150 incidents and so for this year we have been asked for help with 43 incidents. Most of these were not huge, and include ship groundings in Alaska, Oregon, Washington, and Hawaii; five sunken vessels, fires at two marinas, a burning vessel, and an oil platform fire; nine oil spills and a chemical spill; and multiple "mystery sheens"—slicks of oil or chemicals that are spotted on the surface of the water and don't have a clear origin.
Since 1990, we have responded to thousands of incidents, helping to guide effective cleanups and protect sensitive resources. Also, since 1990 and with our co-trustees, we have settled almost 60 spills for more than $9.7 billion for restoration.
We hope that we will never have to respond to another "Deepwater Horizon" or "Exxon Valdez," but should a large disaster occur, we will be ready. In the meantime, smaller accidents happen frequently and we are ready for those, too.


She probably think you forgot it's Valentine's day aslan, so why not surprise her and make her one of these simple, handmade gifts that she'll cherish for eternity! You didn't just remember, you also put the effort into MAKING something yourself! That is bound to give you enough points to last you through the next 10 stupid things you do. Remember, it's the little things that matter.
All you need is a white mug and black and red sharpie (or any permenant marker) and voila, you've got yourselves a gift that is bound to put a smile on your loved ones face every morning.
WE SAID THIS: Don't miss DIY: Simple Valentine's Day Gifts for the Man You Love.
A kid at heart, Nada Kabil finds herself a little in all forms of art. As a kid her main dream was to be a writer. She studied product design and finds herself attracted to anything she can unleash her creativity in and express herself, be it, art, design or writing. Making her laugh or putting her up to a challenge is just one of the many ways of making her day.